Skip to content

Commit

Permalink
Fixes for latest libogc2
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Nov 23, 2024
1 parent fe7e691 commit 4374ccb
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 100 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
sudo sed -i '/^\[dkp-libs\]$/,$d' /opt/devkitpro/pacman/etc/pacman.conf
sudo echo -e '[extremscorner-devkitpro]\nServer = https://packages.extremscorner.org/devkitpro/linux/$arch' >> /opt/devkitpro/pacman/etc/pacman.conf
sudo dkp-pacman -Sy
sudo dkp-pacman -S --noconfirm --ask 4 libogc2 libogc2-libfat libogc2-libntfs
sudo dkp-pacman -S --noconfirm --ask 4 gamecube-tools-git libogc2 libogc2-libdvm libogc2-libntfs
- name: Checkout
uses: actions/checkout@main

Expand Down
47 changes: 19 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include $(DEVKITPRO)/libogc2/wii_rules
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := images source source/sha1-c source/crc32 source/http
SOURCES := source source/sha1-c source/crc32 source/http
DATA := data
INCLUDES := include source/sha1-c source/crc32 source/http
TEXTURES := images
Expand All @@ -26,10 +26,10 @@ TEXTURES := images
# options for code generation
#---------------------------------------------------------------------------------

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

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

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
Expand All @@ -40,7 +40,7 @@ LIBS := -lwiiuse -lbte -lntfs -logc -lfat -lmxml -lm
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS)
LIBDIRS := $(PORTLIBS)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
Expand Down Expand Up @@ -77,32 +77,32 @@ else
export LD := $(CXX)
endif

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(addsuffix .o,$(TPLFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o)
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
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))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))

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

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB)
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
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
Expand All @@ -113,7 +113,6 @@ clean:
run:
wiiload $(TARGET).dol


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

Expand All @@ -125,24 +124,16 @@ DEPENDS := $(OFILES:.o=.d)
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

$(OFILES_SOURCES) : $(HFILES)

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

#---------------------------------------------------------------------------------
%.tpl : %.scf
@echo $(notdir $<)
@gxtexconv -s $< -d $(DEPSDIR)/$*.d -o $@

#---------------------------------------------------------------------------------
%.tpl.o : %.tpl
@echo $(notdir $<)
@$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
Expand Down
47 changes: 19 additions & 28 deletions Makefile.gc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include $(DEVKITPRO)/libogc2/gamecube_rules
#---------------------------------------------------------------------------------
TARGET := cleanrip-gc
BUILD := build
SOURCES := images source source/sha1-c source/crc32 source/http source/m2loader
SOURCES := source source/sha1-c source/crc32 source/http source/m2loader
DATA := data
INCLUDES := include source/sha1-c source/crc32 source/http source/m2loader
TEXTURES := images
Expand All @@ -26,10 +26,10 @@ TEXTURES := images
# options for code generation
#---------------------------------------------------------------------------------

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

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

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
Expand All @@ -40,7 +40,7 @@ LIBS := -lbba -lntfs -logc -lfat -lmxml -lm -ldb
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS)
LIBDIRS := $(PORTLIBS)

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
Expand Down Expand Up @@ -77,32 +77,32 @@ else
export LD := $(CXX)
endif

export OFILES := $(addsuffix .o,$(BINFILES)) \
$(addsuffix .o,$(TPLFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o)
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) $(addsuffix .o,$(TPLFILES))
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))) $(addsuffix .h,$(subst .,_,$(TPLFILES)))

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

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB)
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.gc
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.gc

#---------------------------------------------------------------------------------
clean:
Expand All @@ -113,7 +113,6 @@ clean:
run:
usb-load $(TARGET).dol


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

Expand All @@ -125,24 +124,16 @@ DEPENDS := $(OFILES:.o=.d)
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)

$(OFILES_SOURCES) : $(HFILES)

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

#---------------------------------------------------------------------------------
%.tpl : %.scf
@echo $(notdir $<)
@gxtexconv -s $< -d $(DEPSDIR)/$*.d -o $@

#---------------------------------------------------------------------------------
%.tpl.o : %.tpl
@echo $(notdir $<)
@$(bin2o)

-include $(DEPENDS)

#---------------------------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Introduction
A tool to backup your Gamecube/Wii Discs via IOS58
Create 1:1 backups of your GC/Wii discs for archival purposes without any requirements for custom IOS (cIOS). Supports USB 2.0 / NTFS / FAT32 & Front SD.
Create 1:1 backups of your GC/Wii discs for archival purposes without any requirements for custom IOS (cIOS). Supports USB 2.0 / NTFS / exFAT & Front SD.

# Support
If you have any questions about CleanRip?, please make a thread over at http://www.gc-forever.com/

# Features
* FAT/NTFS
* exFAT/NTFS
* USB 2.0 support
* Front SD support
* BCA Dumping
Expand All @@ -20,15 +20,15 @@ If you have any questions about CleanRip?, please make a thread over at http://w

# Build

1. Install DevkitPro. You can download and install it from the official website: https://devkitpro.org/wiki/Getting_Started
1. Install devkitPPC. You can download and install it from the official website: https://devkitpro.org/wiki/Getting_Started

2. Install libogc2 library. libogc2 is a library for Wii and GameCube homebrew development: https://github.com/extremscorner/libogc2

3. Install dependencies: `pacman -S libogc2-libntfs ppc-mxml`
3. Install dependencies: `pacman -S gamecube-tools-git libogc2 libogc2-libdvm libogc2-libntfs ppc-mxml`

4. Build the project: Run `make` in the root directory of the project.

# Device Compatibility
Please note that the Wii can be picky about particular USB drives/storage devices. It's recommended to use a Y cable for hard drives that fail to power up from one USB port alone. If USB flash storage doesn't want to work, try a different brand/size. SD cards on GameCube will potentially have similar issues, it's best to have a few different brands/sizes/types at your disposal.

CleanRip for GC is also compatible with M.2 SSDs via M.2 Loader - remember to use MBR and not GPT partition table.
CleanRip for GC is also compatible with M.2 SSDs via M.2 Loader.
2 changes: 1 addition & 1 deletion images/boxinner.scf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<filepath="boxinner.bmp" id="boxinner" colfmt=1 />
<filepath="boxinner.bmp" id="boxinner" colfmt=1 wraps=0 wrapt=0 />
2 changes: 1 addition & 1 deletion images/boxouter.scf
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<filepath="boxouter.bmp" id="boxouter" colfmt=1 />
<filepath="boxouter.bmp" id="boxouter" colfmt=1 wraps=0 wrapt=0 />
2 changes: 0 additions & 2 deletions source/FrameBufferMagic.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ void init_textures()
TPL_GetTexture(&btnbTPL,btnb,&btnbTexObj);
TPL_OpenTPLFromMemory(&boxinnerTPL, (void *)boxinner_tpl, boxinner_tpl_size);
TPL_GetTexture(&boxinnerTPL,boxinner,&boxinnerTexObj);
GX_InitTexObjWrapMode(&boxinnerTexObj, GX_CLAMP, GX_CLAMP);
TPL_OpenTPLFromMemory(&boxouterTPL, (void *)boxouter_tpl, boxouter_tpl_size);
TPL_GetTexture(&boxouterTPL,boxouter,&boxouterTexObj);
GX_InitTexObjWrapMode(&boxouterTexObj, GX_CLAMP, GX_CLAMP);
}

void drawInit()
Expand Down
2 changes: 1 addition & 1 deletion source/http/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <unistd.h>
#include <ogcsys.h>
#include <network.h>
#include <ogc/lwp_watchdog.h>
#include <ogc/timesupp.h>
#include <sys/types.h>
#include <sys/errno.h>
#include <fcntl.h>
Expand Down
18 changes: 10 additions & 8 deletions source/m2loader/m2loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,43 +602,45 @@ int M2Loader_Shutdown()
return 1;
}

static bool __m2ldr_startup(void)
static bool __m2ldr_startup(DISC_INTERFACE *disc)
{
return M2Loader_IsDriveInserted();
}

static bool __m2ldr_isInserted(void)
static bool __m2ldr_isInserted(DISC_INTERFACE *disc)
{
return M2Loader_IsInserted() && M2Loader_IsDriveInserted();
}

static bool __m2ldr_readSectors(sec_t sector, sec_t numSectors, void *buffer)
static bool __m2ldr_readSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
{
return !_M2Loader_ReadSectors((u64)sector, numSectors, buffer);
}

static bool __m2ldr_writeSectors(sec_t sector, sec_t numSectors, void *buffer)
static bool __m2ldr_writeSectors(DISC_INTERFACE *disc, sec_t sector, sec_t numSectors, void *buffer)
{
return !_M2Loader_WriteSectors((u64)sector, numSectors, buffer);
}

static bool __m2ldr_clearStatus(void)
static bool __m2ldr_clearStatus(DISC_INTERFACE *disc)
{
return true;
}

static bool __m2ldr_shutdown(void)
static bool __m2ldr_shutdown(DISC_INTERFACE *disc)
{
return true;
}

const DISC_INTERFACE __io_m2ldr = {
DISC_INTERFACE __io_m2ldr = {
DEVICE_TYPE_GC_M2LOADER,
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_PORT2,
(FN_MEDIUM_STARTUP)&__m2ldr_startup,
(FN_MEDIUM_ISINSERTED)&__m2ldr_isInserted,
(FN_MEDIUM_READSECTORS)&__m2ldr_readSectors,
(FN_MEDIUM_WRITESECTORS)&__m2ldr_writeSectors,
(FN_MEDIUM_CLEARSTATUS)&__m2ldr_clearStatus,
(FN_MEDIUM_SHUTDOWN)&__m2ldr_shutdown};
(FN_MEDIUM_SHUTDOWN)&__m2ldr_shutdown,
0x1000000000000,
512};

2 changes: 1 addition & 1 deletion source/m2loader/m2loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define EXI_M2LOADER_ID 0x49444533
#define DEVICE_TYPE_GC_M2LOADER (('M' << 24) | ('2' << 16) | ('L' << 8) | 'R')

extern const DISC_INTERFACE __io_m2ldr;
extern DISC_INTERFACE __io_m2ldr;

// ATA status register bits
#define ATA_SR_BSY 0x80
Expand Down
Loading

0 comments on commit 4374ccb

Please sign in to comment.