-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
To install this library, you will need libromfs-ogc. You must include it alongside the HBM library and copy the romfs/hbm directory to your target project.
This assumes that you have already installed the library to portlibs, otherwise you will have to specify the path to the library and include contents yourself.
- Copy the following to your Makefile, below the "options for code generation" section:
export HBM_CDEFINES := `$(PREFIX)pkg-config --cflags freetype2` $(foreach d,$(HBM_DEFINES),-D$(d))
export HBM_LIBS := -lpngu -lfreetype `$(PREFIX)pkg-config freetype2 libpng --libs` -lasnd
CFLAGS += $(HBM_CDEFINES)
CXXFLAGS += $(HBM_CDEFINES)
ROMFS ?= romfs
-
Include
-lhbm $(HBM_LIBS)inLIBS, before-lwiiuse. -
Finally, if your homebrew project does not already use libromfs-ogc, include the library and add the .romfs.o linkage alongside other binary file extensions.
$(ROMFS_TARGET):
@echo ROMFS $(notdir $@)
$(Q)tar --format=ustar -cvf romfs.tar -C $(ROMFS) .
$(Q)$(OBJCOPY) --input-target binary --output-target elf32-powerpc --binary-architecture powerpc:common romfs.tar $@
@rm -f romfs.tar
- Above
DEPENDS:
include $(PORTLIBS_PATH)/wii/share/romfs-ogc.mk
CFLAGS += $(ROMFS_CFLAGS)
CXXFLAGS += $(ROMFS_CFLAGS)
LIBS += $(ROMFS_LIBS)
OFILES += $(ROMFS_TARGET)
Otherwise, you can copy the romfs/hbm folder over to your existing romfs directory.
In the main loop or wherever the homebrew application checks for the HOME button input, add a condition to do HBM_Menu() immediately before flushing the framebuffer. You can also include a custom reset function if necessary, to set all values to zero.
The following is an example from the GRRLIB-based sample, detailing the static variables and functions declared out of main():
bool shouldReset = false;
void myReset() {
shouldReset = true;
}
static bool HBM_DoWork() {
// Open libHBM
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) {
if (HBM_IsAvailable()) {
HBM_SetMyReset(myReset);
HBM_Menu();
if (shouldReset) {
return true;
}
}
}
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_1) HBM_ToggleUsage(true);
if(WPAD_ButtonsDown(0) & WPAD_BUTTON_2) HBM_ToggleUsage(false);
HBM_DrawNoHome();
return false;
}
And in main() itself:
if (HBM_DoWork()) {
// Reset values
a = 0;
cubeZ = 0;
GRRLIB_FreeTexture(tex_font);
goto start;
}
GRRLIB_Render();