Code Monkey home page Code Monkey logo

grrlib's Introduction

GRRLIB

GitHub Actions Workflow Status Codacy Badge GitHub Discussions Static Badge

Table of Contents

Introduction

GRRLIB is a C/C++ 2D/3D graphics library for Wii application developers. It is essentially a wrapper which presents a friendly interface to the Nintendo GX core.

GRRLIB is supplied as a standard C/C++ library (aka. archive) called 'libgrrlib'. Because GRRLIB processes JPEG and PNG images, it requires the installation of the 'libjpeg' and 'libpngu' libraries. 'libpngu', in turn, requires 'libpng'. GRRLIB has FileIO functions to allow real-time loading and saving of graphical data, and thus requires 'libfat'. GRRLIB also has the possibility to use TrueType fonts, so 'libfreetype' is also required.

libgrrlib          <- 2D/3D graphics library
├── libfat         <- File I/O
├── libjpeg        <- JPEG image processor
├── libpngu        <- Wrapper for libpng
│   └── libpng     <- PNG image processor
└── libfreetype    <- TrueType font processor

Developing for the Wii

Do not progress until you have installed and configured devkitPro. Guides are and assistance are available at https://devkitpro.org/index.php

If you have just performed a clean (re)install on your Windows PC, be sure to reboot before you continue.

Downloading GRRLIB

You are invited to use "the latest Git master version" of GRRLIB at all times.

The Git repository is located at: https://github.com/GRRLIB/GRRLIB

There is a simple guide to "Using GitHub" later in this document.

This document will presume that you have downloaded "the latest Git master version" to a directory called C:\grr

Installing GRRLIB

This guide is for Windows. If you are using Linux, I am going to presume you are smart enough to convert these instructions.

GRRLIB      is supplied as source code
libpngu     is supplied as source code
libpng      is supplied via devkitPro pacman (ppc-libpng)
libfreetype is supplied via devkitPro pacman (ppc-freetype)
libjpeg     is supplied via devkitPro pacman (ppc-libjpeg-turbo)
libfat      is supplied via devkitPro pacman (libfat-ogc)

The easy way is to install GRRLIB and all the required libraries with a few commands:

  c:
  cd \grr\GRRLIB
  pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
  make clean all install

This process may take some time depending on the speed of your PC.

If you used the method above the following steps are not required, GRRLIB is installed and you are ready to start developing Wii homebrew games.

If you want, you could install the libfat, libpng, libfreetype and libjpeg with there dependencies in a single command:

  pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo

Each library could also be installed individually:

To install libpngu:

  c:
  cd \grr\GRRLIB\lib\pngu
  make clean all install

To install libgrrlib for Wii:

  c:
  cd \grr\GRRLIB\GRRLIB
  make clean all install

To install libgrrlib for GameCube:

  c:
  cd \grr\GRRLIB\GRRLIB
  make PLATFORM=cube clean all install

Using GRRLIB

After everything is installed, simply put

#include <grrlib.h>

at the top of your .c/.cpp file and use the functions as required

You will need to add

-lgrrlib -lpngu `$(PREFIX)pkg-config freetype2 libpng libjpeg --libs` -lfat

to the libs line in your makefile

...Remember the order of the libraries is critical. You may (need to) insert other libraries in the middle of the list, you may need to add others to the start, or even the end - but do not change the order of the libraries shown here.

Also add $(PORTLIBS) to the LIBDIRS line in your makefile

You do NOT need to place /anything/ in your application directory.

If you would like to see a working example of this, you can look at the example found in: C:\grr\examples\template\source

Upgrading to v4.4.0 From Previous Versions of GRRLIB

This version now uses the ported libraries for the Wii.

To install them, use this command line:

  pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo

You will need to add $(PORTLIBS) to the LIBDIRS line in your makefile.

Previously it could have looked like this:

LIBDIRS	:=

Now it needs to be like this:

LIBDIRS	:= $(PORTLIBS)

The FreeType library is now compiled with dependencies, so freetype2 must be added to pkg-config in your makefile.

For example:

LIBS	:= -lgrrlib -lpngu `$(PREFIX)pkg-config freetype2 libpng libjpeg --libs` -lfat

Since GRRLIB and libpngu are now installed into the porlibs folder, make sure you don't have any leftovers from previous installations. You will need to manually delete unneeded libraries in devkitPro\libogc\lib\wii as well as include files in devkitPro\libogc\include

Using GitHub

GitHub allows the developers to submit changes to the code in such a way that these changes can be easily monitored, quickly merged together with other changes. and (if necessary) reverted.

It also allows the power-users to gain access to the latest (often "in-test") features.

To obtain the "cutting edge" codebase go to https://github.com/GRRLIB/GRRLIB/tree/master

  1. Create a directory to hold the code (e.g. C:\grr)
  2. Click the Download ZIP button if you don't have the proper tools installed on your PC or Clone the following URL https://github.com/GRRLIB/GRRLIB.git

All official releases can be found here https://github.com/GRRLIB/GRRLIB/releases

Credits

Project Leader

  • NoNameNo

Documentation

  • Crayon
  • BlueChip

Lead Coder

  • NoNameNo

Support Coders

  • Crayon
  • Xane
  • DragonMinded
  • BlueChip
  • elisherer

Advisors

  • RedShade
  • Jespa

Licence

GRRLIB is released under the MIT Licence. If we had chosen the GPL licence you would be +forced+ (legally required) to release your source code. But in the spirit of "free as in FREE" we have left you with the +option+ to release your source code.

We do +request+ that you tell others about us by naming our library (GRRLIB) in the credits of your game/application. And, if you +choose+ to do that, we encourage you to use our logo to achieve it; You can find our logo here: C:\grr\docs\grrlib_logo.png and here: https://grrlib.github.io/GRRLIB/grrlib_logo.png

grrlib's People

Contributors

arthurlm avatar crayon2000 avatar csbluechip avatar htv04 avatar n0namen0 avatar xanefeather avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grrlib's Issues

error with command make clean all install

when i am installing GRRLIB i dd all until the command make clean all install and it gives me the error:
C:\grr\GRRLIB>make clean all install
make: *** No rule to make target 'clean'. Stop.
can someone help me?

Build on Linux

Hello,
i'm trying to build grrlib on linux, but i get immediately this error:

pngu.c
pngu.c:1290:1: fatal error: opening dependency file /pngu.d: Permission denied
 }
 ^
compilation terminated.
/opt/devkitpro/devkitPPC/base_rules:17: recipe for target 'pngu.o' failed
make: *** [pngu.o] Error 1

This happens for every makefile. it seems the dependeny file is not generated correctly.

pass environment variables in documentation

I think the build instructions should have a note for Linux users to use sudo -E to pass the DEVKITPRO and DEVKITPPC environment variables to Make. I was smart enough to convert the instructions, but I got stuck here for hours.

GRRLIB_PrintfTTF and GRRLIB_PrintfTTFW do not display the text in correct alpha value

Hi,

I would like to draw text with some transparency, however the text is always drawn fully opaque, no matter the A value in the RGBA color.
Example:
GRRLIB_PrintfTTF(280, 180, GCFont,LG, fontSize, 0xFF000000); or GRRLIB_PrintfTTF(280, 180, GCFont,LG, fontSize, 0xFF000080); will display the same thing as GRRLIB_PrintfTTF(280, 180, GCFont,LG, fontSize, 0xFF0000FF);

I'm not super knowledgeable in C but looking at the underlying GRRLIB code, it seems to me that the alpha component of the RGBA color is never passed down to the final DrawBitmap function. Instead it takes an argument that I don't really understand for the alpha value:

static void DrawBitmap(FT_Bitmap *bitmap, int offset, int top, const u8 cR, const u8 cG, const u8 cB) {
    FT_Int i, j, p, q;
    FT_Int x_max = offset + bitmap->width;
    FT_Int y_max = top + bitmap->rows;

    for ( i = offset, p = 0; i < x_max; i++, p++ ) {
        for ( j = top, q = 0; j < y_max; j++, q++ ) {
            GX_Begin(GX_POINTS, GX_VTXFMT0, 1);
                GX_Position3f32(i, j, 0);
                GX_Color4u8(cR, cG, cB,
                            bitmap->buffer[ q * bitmap->width + p ]);
            GX_End();
        }
    }
}

Add .OBJ loader

Just found this branch exists. I've my own .OBJ loader implementation (no materials support, just diffuse).
I think would be amazing to have this function implemented in Vanilla GRRLIB.

Do you have any plan to implement it?

Thanks!!!

powerpc-eabi-gcc: No such file or directory

i cloned the grrlib source code and entered the directory GRRLIB and ran make clean but when i run make all i get this

`


pngu.c
make[2]: powerpc-eabi-gcc: No such file or directory
make[2]: *** [pngu.o] Error 1
make[1]: *** [all] Error 1
make: *** [all] Error 1
`

Compiling+installing seems to be problematic on GNU/Linux

After installing all the needed packages using pacman, installing GRRLIB seems to fail.

make[1]: Entering directory '/home/peter/gitrepos/GRRLIB/GRRLIB/GRRLIB'
GRRLIB_3D.c
GRRLIB_3D.c:804:1: fatal error: opening dependency file /GRRLIB_3D.d: Permission denied
  804 | }
      | ^
compilation terminated.
make[1]: *** [/opt/devkitpro/devkitPPC//base_rules:18: GRRLIB_3D.o] Error 1

I'm not really sure why this fails, but running it as root seems to work... although that causes the issue of having this later

/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/10.2.0/../../../../powerpc-eabi/bin/ld: cannot open map file 3D_CubedTileDemo.elf.map: Permission denied

this does compile fine if I set the needed environment variables and run it as root
I'm probably just being stupid, but I'm not really sure if there is a more appropriate way than just opening an issue on this repo.

'cannot find -libgrrlib'

Hello,
I was trying to compile the examples, but when I run the make command, I get the following output:
-----------------------------------------------------------
make[1]: Entering directory '/c/grr/examples/3D_CubedTileDemo'
main.c
linking ... 3D_CubedTileDemo.elf
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: cannot find -libgrrlib: No such file or directory
collect2.exe: error: ld returned 1 exit status
make[2]: *** [/opt/devkitpro/devkitPPC/wii_rules:31: /c/grr/examples/3D_CubedTileDemo/3D_CubedTileDemo.elf] Error 1
make[1]: *** [Makefile:101: build] Error 2
make[1]: Leaving directory '/c/grr/examples/3D_CubedTileDemo'
make: *** [Makefile:4: all] Error 1

I made sure that GRRLIB was installed correctly, and it looks like there aren't any issues with the installation.
Am I missing something?

Bug while installing GRRLIB on Windows

Hi, i try to install GRRLIB on Windows after compiling it and i have this issue :

cp: target '/opt/devkitpro/portlibs/wii/include' is not a directory
make[1]: *** [Makefile:98: install] Error 1
make[1]: Leaving directory '/home/teoja/Documents/Grrlib/GRRLIB/GRRLIB/GRRLIB'
make: *** [Makefile:15: install] Error 1

Can you help me please ?

Example wont complile

C:\Users\fireh\Documents\Gameblox\Game>make
linking ... Game.elf
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_face_globals_free':
autofit.c:(.text.af_face_globals_free+0xa8): undefined reference to `hb_font_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_free+0xb0): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `hb_ft_reference_table_':
autofit.c:(.text.hb_ft_reference_table_+0x8c): undefined reference to `hb_blob_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_shaper_get_coverage':
autofit.c:(.text.af_shaper_get_coverage+0x70): undefined reference to `hb_font_get_face'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0xbc): undefined reference to `hb_ot_tags_from_script_and_language'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x120): undefined reference to `hb_set_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x144): undefined reference to `hb_ot_layout_collect_lookups'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x14c): undefined reference to `hb_set_is_empty'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x158): undefined reference to `hb_set_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x178): undefined reference to `hb_ot_layout_lookup_collect_glyphs'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x184): undefined reference to `hb_set_next'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x1a8): undefined reference to `hb_set_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x1d0): undefined reference to `hb_ot_layout_collect_lookups'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x1d8): undefined reference to `hb_set_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x1f0): undefined reference to `hb_ot_layout_lookup_collect_glyphs'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x1fc): undefined reference to `hb_set_next'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x2b8): undefined reference to `hb_ot_layout_lookup_would_substitute'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x2cc): undefined reference to `hb_set_next'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x310): undefined reference to `hb_set_subtract'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x334): undefined reference to `hb_set_next'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x370): undefined reference to `hb_set_next'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x380): undefined reference to `hb_set_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x388): undefined reference to `hb_set_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x390): undefined reference to `hb_set_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x398): undefined reference to `hb_set_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x3f8): undefined reference to `hb_set_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x41c): undefined reference to `hb_ot_layout_collect_lookups'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_coverage+0x424): undefined reference to `hb_set_is_empty'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_face_globals_new':
autofit.c:(.text.af_face_globals_new+0xe4): undefined reference to `hb_face_create_for_tables'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_new+0xf4): undefined reference to `hb_face_set_index'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_new+0x100): undefined reference to `hb_face_set_upem'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_new+0x108): undefined reference to `hb_font_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_new+0x114): undefined reference to `hb_face_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_new+0x11c): undefined reference to `hb_buffer_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_new+0x584): undefined reference to `hb_blob_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_new+0x590): undefined reference to `hb_face_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_face_globals_new+0x59c): undefined reference to `hb_blob_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_shaper_get_cluster':
autofit.c:(.text.af_shaper_get_cluster+0x70): undefined reference to `hb_font_set_scale'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0xbc): undefined reference to `hb_buffer_clear_contents'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0xd4): undefined reference to `hb_buffer_add_utf8'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0xdc): undefined reference to `hb_buffer_guess_segment_properties'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0xf4): undefined reference to `hb_shape'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0x10c): undefined reference to `hb_buffer_clear_contents'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0x124): undefined reference to `hb_buffer_add_utf8'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0x12c): undefined reference to `hb_buffer_guess_segment_properties'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0x140): undefined reference to `hb_shape'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0x14c): undefined reference to `hb_buffer_get_glyph_infos'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0x15c): undefined reference to `hb_buffer_get_glyph_infos'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0x174): undefined reference to `hb_buffer_get_length'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_shaper_get_cluster+0x258): undefined reference to `hb_buffer_clear_contents'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_cjk_metrics_init_widths':
autofit.c:(.text.af_cjk_metrics_init_widths+0x64): undefined reference to `hb_buffer_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_init_widths+0xc4): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_init_widths+0x180): undefined reference to `hb_buffer_get_glyph_infos'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_init_widths+0x190): undefined reference to `hb_buffer_get_glyph_positions'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_init_widths+0x1b0): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_cjk_metrics_init_blues':
autofit.c:(.text.af_cjk_metrics_init_blues+0x44): undefined reference to `hb_buffer_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_init_blues+0x2f0): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_init_blues+0x308): undefined reference to `hb_buffer_get_glyph_infos'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_init_blues+0x318): undefined reference to `hb_buffer_get_glyph_positions'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_latin_metrics_init_widths':
autofit.c:(.text.af_latin_metrics_init_widths+0x64): undefined reference to `hb_buffer_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init_widths+0xc4): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init_widths+0x180): undefined reference to `hb_buffer_get_glyph_infos'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init_widths+0x190): undefined reference to `hb_buffer_get_glyph_positions'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init_widths+0x1b0): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_latin_metrics_init_blues':
autofit.c:(.text.af_latin_metrics_init_blues+0x68): undefined reference to `hb_buffer_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init_blues+0x380): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init_blues+0x54c): undefined reference to `hb_buffer_get_glyph_infos'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init_blues+0x55c): undefined reference to `hb_buffer_get_glyph_positions'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_latin_metrics_init':
autofit.c:(.text.af_latin_metrics_init+0xc4): undefined reference to `hb_buffer_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init+0x124): undefined reference to `hb_buffer_get_glyph_infos'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init+0x134): undefined reference to `hb_buffer_get_glyph_positions'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_latin_metrics_init+0x198): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/portlibs/ppc/lib\libfreetype.a(autofit.o): in function `af_cjk_metrics_check_digits.isra.0':
autofit.c:(.text.af_cjk_metrics_check_digits.isra.0+0x4c): undefined reference to `hb_buffer_create'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_check_digits.isra.0+0xb4): undefined reference to `hb_buffer_get_glyph_infos'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_check_digits.isra.0+0xc4): undefined reference to `hb_buffer_get_glyph_positions'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_check_digits.isra.0+0x108): undefined reference to `hb_buffer_destroy'
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: autofit.c:(.text.af_cjk_metrics_check_digits.isra.0+0x154): undefined reference to `hb_buffer_destroy'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitPPC/gamecube_rules:31: /home/fireh/Documents/Game/Game/Game.elf] Error 1
make: *** [Makefile:104: build] Error 2

I have devkitpro and have compiles games on it its just grrlib thats giving me issues

Missing documentation / weird behaviour with PNG where `size % 4 != 0`

Hi,

This question may have been ask earlier on GRRLIB forum, but I did not find any reference to this issue.

Problem description

There is weird / maybe undocumented behavior with PNG texture loading.
If texture width or height is not multiple of 4, then PNG data is zeroed.

This is due to the following check in GRRLIB_LoadTexturePNG:

if (imgProp.imgWidth != width || imgProp.imgHeight != height) {
// PNGU has resized the texture
memset(my_texture->data, 0, (my_texture->h * my_texture->w) << 2);
}

Width and height parameter are changed in libpngu in function PNGU_DecodeTo4x4RGBA8 here:

if(padWidth%4) padWidth += (4-padWidth%4);
if(padHeight%4) padHeight += (4-padHeight%4);

There are others conditions that may update witdh and height but this one is the most obvious and error prone to me.

Questions

What is the exact purpose of this check ?
Why cannot we load not multiple by 4 PNG data ?
When check is removed, all seems to work fine. Is this related to Wii hardware ?

Do we really need to recompute image size + decode PNG data if content is zeroed after ?
Does this check can be moved to libpngu ?
Looking at the code, most PNG loading tricks are not needed if we drop content.
Function can be simplified (see 2654a89).

This may be silly, but what is the exact purpose of libpngu ?
Is it here to make an abstraction layer between GRRLIB and libpng ?
Does it come from somewhere else ? Most of the code in it look unused / dead.

Should we add some documentation on GRRLIB_LoadTexturePNG on the image size multiple by 4 (instead of not correct) ?

Code to reproduce

I have made a branch on repository fork to store code and resources (see commit: 2b73935).

Bellow are some screenshot of running application.

  • with image of 352*89:
    image

  • with image of 352*82:
    image

Examples for Gamecube don't compile

Hello, I've installed GRRLIB from git and it doesn't build Gamecube examples, but it works fine with Wii ones.

yeji@yejis-MacBook-Pro ~/git/GRRLIB/examples/gamecube/3D_CubedTileDemo $ make
bg.png
logo.png
nonameno.png
perso.png
tile1.png
main.c
/Users/yeji/git/GRRLIB/examples/gamecube/3D_CubedTileDemo/source/main.c:6:10: fatal error: grrlib.h: No such file or directory
    6 | #include <grrlib.h>
      |          ^~~~~~~~~~
compilation terminated.
make[1]: *** [main.o] Error 1
make: *** [build] Error 2
yeji@yejis-MacBook-Pro ~/git/GRRLIB/examples/gamecube/3D_CubedTileDemo $ cd ../../3D_CubedTileDemo/
yeji@yejis-MacBook-Pro ~/git/GRRLIB/examples/3D_CubedTileDemo $ make
bg.png
logo.png
nonameno.png
perso.png
tile1.png
main.c
linking ... 3D_CubedTileDemo.elf
output ... 3D_CubedTileDemo.dol
yeji@yejis-MacBook-Pro ~/git/GRRLIB/examples/3D_CubedTileDemo $ 

Here's how I installed the lib:

yeji@yejis-MacBook-Pro ~/git/GRRLIB/GRRLIB $ make PLATFORM=cube clean all
rm -f pngu.o pngu.d libpngu.a
rm -f GRRLIB_3D.o GRRLIB_bmf.o GRRLIB_bmfx.o GRRLIB_core.o GRRLIB_fbAdvanced.o GRRLIB_fileIO.o GRRLIB_gecko.o GRRLIB_print.o GRRLIB_render.o GRRLIB_snapshot.o GRRLIB_texEdit.o GRRLIB_ttf.o GRRLIB_3D.d GRRLIB_bmf.d GRRLIB_bmfx.d GRRLIB_core.d GRRLIB_fbAdvanced.d GRRLIB_fileIO.d GRRLIB_gecko.d GRRLIB_print.d GRRLIB_render.d GRRLIB_snapshot.d GRRLIB_texEdit.d GRRLIB_ttf.d libgrrlib.a
-----------------------------------------------------------
-----------------------------------------------------------
pngu.c
powerpc-eabi-gcc-ar -r libpngu.a pngu.o
/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/12.1.0/../../../../powerpc-eabi/bin/ar: creating libpngu.a
-----------------------------------------------------------
GRRLIB_3D.c
GRRLIB_bmf.c
GRRLIB_bmfx.c
GRRLIB_core.c
GRRLIB_fbAdvanced.c
GRRLIB_fileIO.c
GRRLIB_gecko.c
GRRLIB_print.c
GRRLIB_render.c
GRRLIB_snapshot.c
GRRLIB_texEdit.c
GRRLIB_ttf.c
powerpc-eabi-gcc-ar -r libgrrlib.a GRRLIB_3D.o GRRLIB_bmf.o GRRLIB_bmfx.o GRRLIB_core.o GRRLIB_fbAdvanced.o GRRLIB_fileIO.o GRRLIB_gecko.o GRRLIB_print.o GRRLIB_render.o GRRLIB_snapshot.o GRRLIB_texEdit.o GRRLIB_ttf.o
/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/12.1.0/../../../../powerpc-eabi/bin/ar: creating libgrrlib.a
yeji@yejis-MacBook-Pro ~/git/GRRLIB/GRRLIB $ sudo bash
yejis-MacBook-Pro GRRLIB # make install
Makefile:6: *** "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC.  Stop.
make[1]: *** [install] Error 1
make: *** [install] Error 1
yejis-MacBook-Pro GRRLIB # razzle
yejis-MacBook-Pro GRRLIB # make install
mkdir -p  /opt/devkitpro/portlibs/ppc/lib  /opt/devkitpro/portlibs/ppc/include
cp -f libpngu.a /opt/devkitpro/portlibs/ppc/lib/
cp -f pngu.h /opt/devkitpro/portlibs/ppc/include
mkdir -p  /opt/devkitpro/portlibs/wii/lib  /opt/devkitpro/portlibs/wii/include  /opt/devkitpro/portlibs/wii/include/grrlib
cp -f libgrrlib.a /opt/devkitpro/portlibs/wii/lib/
cp -f grrlib.h /opt/devkitpro/portlibs/wii/include/
cp -f grrlib/GRRLIB__inline.h grrlib/GRRLIB__lib.h grrlib/GRRLIB_clipping.h grrlib/GRRLIB_collision.h grrlib/GRRLIB_fbComplex.h grrlib/GRRLIB_fbGX.h grrlib/GRRLIB_fbSimple.h grrlib/GRRLIB_handle.h grrlib/GRRLIB_pixel.h grrlib/GRRLIB_private.h grrlib/GRRLIB_settings.h grrlib/GRRLIB_texSetup.h /opt/devkitpro/portlibs/wii/include/grrlib
yejis-MacBook-Pro GRRLIB #

Examples don't work properly

I was unable to properly run a few of the examples in the newest version of GRRLIB.
Bitmap_fx
3D_sample3
unlimited2D

I didn't test many more of them, None of these properly display textures or text for me, they end up corrupted or don't display at all, however using GRRLIB 4.3.2 seemed to fix the issue.

Question regarding 3D object rotation

It is possible to do multiple transformations in an object "block" (begin - end).

GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewRotate(0,0,a*4);
GRRLIB_ObjectViewTrans(0,1.0,0);
GRRLIB_ObjectViewRotate(0,0,a*2);
GRRLIB_ObjectViewTrans(0,0.5,0);
GRRLIB_ObjectViewRotate(0,0,a*2);
GRRLIB_ObjectViewEnd();

GRRLIB_DrawCube(0.4f,0.5,0x0000FFFF);

It seems that rotation is always relative to 0,0,0 position.

How can I make my object rotate relatively to a 0,1,0 ?
I need to rotate object like a planet orbit around the sun, not on itself.

//The following code won't work
GRRLIB_ObjectViewBegin();
GRRLIB_ObjectViewTrans(0,1.0,0);
GRRLIB_ObjectViewTrans(0,0.5,0);
GRRLIB_ObjectViewRotate(0,0,a*2);
GRRLIB_ObjectViewEnd();

GRRLIB_DrawCube(0.4f,0.5,0x0000FFFF);

problem compilng

Whenever I try to compile I get this
powerpc-eabi-gcc: fatal error: cannot specify '-o' with '-c', '-S' or '-E' with multiple files'

Fatal error with powerpc-eabi-gcc.exe

Hi there, I'm running into an error which is preventing me from installing GRRLIB. I'm using windows 10. I follow the code:

cd \grr\GRRLIB
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
make clean all install

which errors out on the last command with,

$ make clean all install
make[1]: Entering directory '/home/jikac/Documents/Gamecube Development/libraries/GRRLIB-master/GRRLIB/GRRLIB'
rm -f GRRLIB_3D.o GRRLIB_bmf.o GRRLIB_bmfx.o GRRLIB_core.o GRRLIB_fbAdvanced.o GRRLIB_fileIO.o GRRLIB_gecko.o GRRLIB_print.o GRRLIB_render.o GRRLIB_snapshot.o GRRLIB_texEdit.o GRRLIB_ttf.o GRRLIB_3D.d GRRLIB_bmf.d GRRLIB_bmfx.d GRRLIB_core.d GRRLIB_fbAdvanced.d GRRLIB_fileIO.d GRRLIB_gecko.d GRRLIB_print.d GRRLIB_render.d GRRLIB_snapshot.d GRRLIB_texEdit.d GRRLIB_ttf.d libgrrlib.a
make[1]: Leaving directory '/home/jikac/Documents/Gamecube Development/libraries/GRRLIB-master/GRRLIB/GRRLIB'
make[1]: Entering directory '/home/jikac/Documents/Gamecube Development/libraries/GRRLIB-master/GRRLIB/lib'
make[2]: Entering directory '/home/jikac/Documents/Gamecube Development/libraries/GRRLIB-master/GRRLIB/lib/pngu'
rm -f pngu.o pngu.d libpngu.a
make[2]: Leaving directory '/home/jikac/Documents/Gamecube Development/libraries/GRRLIB-master/GRRLIB/lib/pngu'
make[1]: Leaving directory '/home/jikac/Documents/Gamecube Development/libraries/GRRLIB-master/GRRLIB/lib'
-----------------------------------------------------------
make[1]: Entering directory '/home/jikac/Documents/Gamecube Development/libraries/GRRLIB-master/GRRLIB/GRRLIB'
GRRLIB_3D.c
powerpc-eabi-gcc.exe: fatal error: cannot specify '-o' with '-c', '-S' or '-E' with multiple files
compilation terminated.
make[1]: *** [/opt/devkitpro/devkitPPC/base_rules:18: GRRLIB_3D.o] Error 1
make[1]: Leaving directory '/home/jikac/Documents/Gamecube Development/libraries/GRRLIB-master/GRRLIB/GRRLIB'
make: *** [Makefile:4: all] Error 1

I'm looking for some advice on how to get past this error.

Any idea as to why a particularly large PNG wouldn't load?

So, I have this large .png spritesheet (1616x1920px) and while it seems to load (I DID receive a pointer from GRRLIB_LoadTextureFromFile(), mind you!), the entire texture is transparent (I guess that the image size is "incorrect" according to the docs?). Is there any workaround for this problem that doesn't require manual png edits? Here is a screenshot of code snipped with load attempt results:
image

GX_end is static compile warning

Good day all.

just trying to update my libogc to the latest version but I am getting this warning when compiling my current project;

:/devkitPro/libogc/include/grrlib/GRRLIB_fbGX.h:45:5: warning: 'GX_End' is static but used in inline function 'GRRLIB_GXEngine' which is not static
GX_End();
^~~~~~

I get about 17 or so errors anywhere a GX function ( e.g. GX_Color1u32(color[i]); GX_Position3f32(v[i].x, v[i].y, v[i].z); ) is used in GRRLIB. my own code compiles and runs fine. is there anything I can do about the warnings or just ignore them?

Various issues with the camera

I've found a few issues with the camera recently. The most likely problem is that I'm not using it properly, if I'm not, please tell me.

Problem 1: When using GRRLIB_Camera3dSettings to change the position of the camera, it seems to pivot towards the origin. One way around this is to change the rotation of the same axis by the same amounts.

Problem 2: When rotating the camera, the closer I get to 90 degrees in any direction, the slower the rotation gets. The camera never rotates a full 360 degrees.

Like I said, I'm probably using the camera wrong, this is how I am updating it every frame:
GRRLIB_Camera3dSettings(position.x, position.y, position.z, 0, 1, 0, rotation.x, rotation.y, rotation.z);

Drawing 3D over 2D

I'm trying to draw 3D objects over 2D but it seems like doing any kind of 2D operation (including GRRLIB_FillScreen) before 3D ones makes the 3D not show up at all. I'm trying to use GRRLIB_CompoStart and GRRLIB_CompoEnd and then render that out to a texture (which does work if the 3D drawing code is first.) I guess I was kind of expecting it to draw to something like an FBO instead the main frame buffer. However, I can't really render 3D first with my setup, I need to draw some 2D, then some 3D, then some 2D on top of that. Is there any way I can clear all the 2D stuff blocking the way of the 3D stuff so far when doing CompoStart or do I have to always draw 3D first?

ld cannot find [-lfreetype, -lbz2, -lpng, -ljpeg, -lz]: : No such file or directory

Hi. I'm currently trying to use images and fonts to develop something for the Wii. I did the "make" command and I get this instead of finishing off the compiling process:
First it was this:

C:\GRRLIB-4.4.1\examples\be_gui>make
frnpd.ttf
recovery_instruction.mp3
BE.c
C:/GRRLIB-4.4.1/examples/be_gui/source/BE.c:1:10: fatal error: grrlib.h: No such file or directory
    1 | #include <grrlib.h>
      |          ^~~~~~~~~~
compilation terminated.
make[1]: *** [/opt/devkitpro/devkitPPC/base_rules:21: BE.o] Error 1
make: *** [Makefile:105: build] Error 2

then this:

C:\GRRLIB-4.4.1\examples\be_gui>make
BE.c
In file included from C:/GRRLIB-4.4.1/examples/be_gui/source/BE.c:13:
C:/GRRLIB-4.4.1/examples/be_gui/source/all_gfx.h:22:10: fatal error: frnpd.h: No such file or directory
   22 | #include "frnpd.h"
      |          ^~~~~~~~~
compilation terminated.
make[1]: *** [/opt/devkitpro/devkitPPC/base_rules:21: BE.o] Error 1
make: *** [Makefile:105: build] Error 2

i putted the grrlib.h and the frnpd [my font] in the C:\devkitPro\libogc\include directory, now i get this:

linking ... be_gui.elf
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/libogc/lib/wii\libgrrlib.a(GRRLIB_core.o):C:/GRRLIB/GRRLIB/grrlib.h:176: multiple definition of `rmode'; BE.o:C:/projects/nintendo/wii/be_gui/source/BE.c:14: first defined here
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: C:/devkitPro/libogc/lib/wii\libgrrlib.a(GRRLIB_core.o):C:/GRRLIB/GRRLIB/grrlib.h:177: multiple definition of `xfb'; BE.o:C:/projects/nintendo/wii/be_gui/source/BE.c:15: first defined here
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: cannot find -lfreetype: No such file or directory
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: cannot find -lbz2: No such file or directory
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: cannot find -lpng: No such file or directory
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: cannot find -ljpeg: No such file or directory
C:/devkitPro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld.exe: cannot find -lz: No such file or directory
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/devkitPPC/wii_rules:31: /c/projects/nintendo/wii/be_gui/be_gui.elf] Error 1
make: *** [Makefile:105: build] Error 2

Some questions you might start asking that I might know and that I can answer are:

  1. Did you install the required libraries? Well yes, I even tried uninstalling and reinstalling the libraries, but that doesn't count.

Now its my turn to ask y'all a question. Why I'm getting this compile error and is there a solution to this?

GDB and GRRLIB: undefined reference to DEBUG_Init

/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld: main.o: in function `main':
/Users/lily/sandbox/gamecube-devkitpro-test/source/main.cpp:16:(.text.startup.main+0x20): undefined reference to `DEBUG_Init'

I'm trying to use libogc's implementation of gdb, but I can't seem to get it to work with the template example for GRRLIB.

I'm fairly certain I've written a minimal example here, though I'm relatively new to C/C++ so I could be way off base.

I'm able to build and run the gdbstub.c example from devkitPro, and connect via gdb, and I can build and run the examples for GRRLIB, but I'm unable get gdb working within GRRLIB.

I've included the make command I'm running and its output, the main.cpp file I'm trying to compile, and the Makefile I'm using to build the project.

I'm able to build other libogc and GRRLIB projects just fine, but I'm unsure of next steps for debugging this issue.


Attempting to run make clean and make

$ make clean && make
clean ...
main.cpp
linking ... gamecube-devkitpro-test.elf
/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld: main.o: in function `main':
/Users/lily/sandbox/gamecube-devkitpro-test/source/main.cpp:16:(.text.startup.main+0x20): undefined reference to `DEBUG_Init'
/opt/devkitpro/devkitPPC/bin/../lib/gcc/powerpc-eabi/13.2.0/../../../../powerpc-eabi/bin/ld: /Users/lily/sandbox/gamecube-devkitpro-test/source/main.cpp:20:(.text.startup.main+0x30): undefined reference to `_break'
collect2: error: ld returned 1 exit status
make[1]: *** [/Users/lily/sandbox/gamecube-devkitpro-test/gamecube-devkitpro-test.elf] Error 1
make: *** [build] Error 2

main.cpp

#include <debug.h>
#include <grrlib.h>
#include <stdio.h>
#include <stdlib.h>


int main(int argc, char **argv) {
	// Initialise the Graphics & Video subsystem
	GRRLIB_Init();

	// Initialise the GameCube controllers
	PAD_Init();

	/* Configure for use with USB on EXI channel 1 (memcard slot B) */
	/* Other option: GDBSTUB_DEVICE_TCP. Note: second parameter acts as port for this type of device */
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	printf("Waiting for debugger...\n");
	/* This function call enters the debug stub for the first time */
	/* It's needed to call this if one wants to start debugging. */
	_break();
	printf("debugger connected...\n");

	// Loop forever
	while(1) {
		PAD_ScanPads(); // Scan the GameCube controllers

		// If [START/PAUSE] was pressed on the first GameCube controller, break out of the loop
		if (PAD_ButtonsDown(0) & PAD_BUTTON_START) break;

		// ---------------------------------------------------------------------
		// Place your drawing code here
		// ---------------------------------------------------------------------

		GRRLIB_Render(); // Render the frame buffer to the TV
	}

	GRRLIB_Exit(); // Be a good girl, clear the memory allocated by GRRLIB

	exit(0);  // Use exit() to exit a program, do not use 'return' from main()
}

Makefile

#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

include $(DEVKITPPC)/gamecube_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET		:=	$(notdir $(CURDIR))
BUILD		:=	build
SOURCES		:=	source
DATA		:=	
INCLUDES	:=	

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------

CFLAGS	= -g -O2 -Wall $(MACHDEP) $(INCLUDE)
CXXFLAGS	=	$(CFLAGS)

LDFLAGS	=	-g $(MACHDEP) -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
# the order can-be/is critical
#---------------------------------------------------------------------------------
LIBS	:= -lgrrlib -lpngu `$(PREFIX)pkg-config freetype2 libpng libjpeg --libs` -lfat
#LIBS	+= -lmodplay -laesnd
LIBS	+= -logc -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS	:= $(PORTLIBS)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT	:=	$(CURDIR)/$(TARGET)

export VPATH	:=	$(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
					$(foreach dir,$(DATA),$(CURDIR)/$(dir))

export DEPSDIR	:=	$(CURDIR)/$(BUILD)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES	:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES		:=	$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES	:=	$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))

#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
	export LD	:=	$(CC)
else
	export LD	:=	$(CXX)
endif

export OFILES_BIN	:=	$(addsuffix .o,$(BINFILES))
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)

export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))

#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE	:=	$(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
					$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
					-I$(CURDIR)/$(BUILD) \
					-I$(LIBOGC_INC)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS	:= -L$(LIBOGC_LIB) $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

export OUTPUT	:=	$(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
	@[ -d $@ ] || mkdir -p $@
	@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
	@echo clean ...
	@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol

#---------------------------------------------------------------------------------
run:
	wiiload $(TARGET).dol


#---------------------------------------------------------------------------------
else

DEPENDS	:=	$(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

$(OFILES_SOURCES) : $(HFILES)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o	:	%.jpg
#---------------------------------------------------------------------------------
	@echo $(notdir $<)
	$(bin2o)

#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o	:	%.png
#---------------------------------------------------------------------------------
	@echo $(notdir $<)
	$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

Compilation on Ubuntu WSL

I have been making WII stuff without any graphics. Just looking at the registers in Dolphin was good enogh for me but now I want to make actual games. I have been using Ubuntu WSL to compile my code because it is more reliable than msys2 in my opinion. When I tried to install GRRLIB it gave me manny errors. I worked through a few but now I cannot figure it out. I tried running msys2 and it compiled but it is annoying to have to use msys2 rather than WSL which works with VSCode. I get one of two errors

make[1]: Entering directory '/mnt/c/grr/GRRLIB/GRRLIB'
GRRLIB_gecko.c
powerpc-eabi-gcc.exe: fatal error: cannot execute 'cc1': CreateProcess: No such file or directory
compilation terminated.
make[1]: *** [/mnt/c/devkitPro/devkitPPC/base_rules:24: GRRLIB_gecko.o] Error 1
make[1]: Leaving directory '/mnt/c/grr/GRRLIB/GRRLIB'
make: *** [Makefile:4: all] Error 1

or sometimes i get this

liblto_plugin-0.dll not found

I don't really know why it is an issue that i am on WSL rather than msys2 and the only changes that I have made to the original make file is using absoulte path names rather than makefile varibles that had nothing in them. If I did not do this it would fail because it couldnt find powerpc-eabi-gcc.exe

Is it possible that after compiling GRRLIB with msys2 that i could move it to Ubuntu?

mkdir: illegal option -- -

When trying to build GRRLIB, i get the error

libgrrlib.a
mkdir: illegal option -- -
usage: mkdir [-pv] [-m mode] directory_name ...
make[2]: *** [install] Error 64
make[1]: *** [install] Error 1
make: *** [install] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.