Support to compile with old devkitPPC/libogc.

This commit is contained in:
retro100 2021-04-27 12:16:40 +00:00
parent cbfd36873b
commit 2f0567b9ef
9 changed files with 315 additions and 23 deletions

View File

@ -175,3 +175,17 @@ If the compilation is successful the file `dosbox-wii.dol` is created.
Now `dosbox-wii.dol` can be executed on the Wii. The easiest way is to replace the `boot.dol` file of an existing dosbox-wii installation (sd:/apps/dosbox-wii) with this file. In this case the name `dosbox-wii.dol` must also be renamed to `boot.dol` accordingly.
# Compilation with old devkitPPC, libogc, etc.
Download and install the following files from https://wii.leseratte10.de/devkitPro/
* devkitppc-amd64_26.tar.xz
* libogc-1.8.11-22.04.2012.zip
* libfat-ogc-1.0.11.tar.bz2
* freetype-2.3.11-ppc.tar.bz2
* ppc-zlib-1.2.11-1-any.pkg.tar.xz
* tremor-lowmem-ppc.tar.bz2
* ppc-libpng-1.6.34-1-any.pkg.tar.xz
* SDL.Wii.10-28-2013.zip

View File

@ -30,7 +30,7 @@ INCLUDES := include src/platform/wii
#---------------------------------------------------------------------------------
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) \
-Wno-strict-aliasing -DWORDS_BIGENDIAN
-Wno-strict-aliasing -DWORDS_BIGENDIAN -DOLD_LIBS
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
@ -38,7 +38,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
# any extra libraries we wish to link with
#---------------------------------------------------------------------------------
LIBS := -lSDL -lfat -lwiiuse -lbte -lasnd -logc -lwiikeyboard \
-lpng -lvorbisidec -logg -lfreetype -lbz2 -lz
-lpng -lvorbisidec -lfreetype -lz
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
@ -67,9 +67,10 @@ 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,$(SOURCES),$(notdir $(wildcard $(dir)/*.ttf) \
$(wildcard $(dir)/*.lang) $(wildcard $(dir)/*.png) \
$(wildcard $(dir)/*.ogg) $(wildcard $(dir)/*.pcm)))
TTFFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.ttf)))
PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png)))
OGGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.ogg)))
PCMFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcm)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
@ -80,11 +81,10 @@ 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)))
export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(TTFFILES:.ttf=.ttf.o) $(PNGFILES:.png=.png.o) \
$(OGGFILES:.ogg=.ogg.o) $(PCMFILES:.pcm=.pcm.o)
#---------------------------------------------------------------------------------
# build a list of include paths
@ -92,7 +92,7 @@ export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) \
-I$(LIBOGC_INC) -I$(PORTLIBS_PATH)/wii/include/SDL -I$(PORTLIBS_PATH)/ppc/include/freetype2
-I$(LIBOGC_INC) -I$(LIBOGC_INC)/SDL -I$(PORTLIBS)/include/freetype2
#---------------------------------------------------------------------------------
# build a list of library paths
@ -106,7 +106,7 @@ export OUTPUT := $(CURDIR)/$(TARGET)
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -j4 -C $(BUILD) -f $(CURDIR)/Makefile
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@ -132,27 +132,22 @@ DEPENDS := $(OFILES:.o=.d)
$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)
$(OFILES_SOURCES): $(HFILES)
#---------------------------------------------------------------------------------
# This rule links in binary data with .ttf, .png, and .mp3 extensions
#---------------------------------------------------------------------------------
%.ttf.o %_ttf.h : %.ttf
%.ttf.o : %.ttf
@echo $(notdir $<)
$(bin2o)
%.lang.o %_lang.h : %.lang
%.png.o : %.png
@echo $(notdir $<)
$(bin2o)
%.png.o %_png.h : %.png
%.ogg.o : %.ogg
@echo $(notdir $<)
$(bin2o)
%.ogg.o %_ogg.h : %.ogg
@echo $(notdir $<)
$(bin2o)
%.pcm.o %_pcm.h : %.pcm
%.pcm.o : %.pcm
@echo $(notdir $<)
$(bin2o)

163
Makefile.currentDevkitPPC Normal file
View File

@ -0,0 +1,163 @@
#---------------------------------------------------------------------------------
# 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)/wii_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 := src src/cpu src/debug src/dos src/fpu src/gui \
src/hardware src/hardware/mame \
src/hardware/serialport src/ints src/libs \
src/misc src/platform/wii src/platform/wii/fonts \
src/platform/wii/images src/platform/wii/libwiigui \
src/platform/wii/sounds src/shell
INCLUDES := include src/platform/wii
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) \
-Wno-strict-aliasing -DWORDS_BIGENDIAN
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with
#---------------------------------------------------------------------------------
LIBS := -lSDL -lfat -lwiiuse -lbte -lasnd -logc -lwiikeyboard \
-lpng -lvorbisidec -logg -lfreetype -lbz2 -lz
#---------------------------------------------------------------------------------
# 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,$(SOURCES),$(notdir $(wildcard $(dir)/*.ttf) \
$(wildcard $(dir)/*.lang) $(wildcard $(dir)/*.png) \
$(wildcard $(dir)/*.ogg) $(wildcard $(dir)/*.pcm)))
#---------------------------------------------------------------------------------
# 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),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) \
-I$(LIBOGC_INC) -I$(PORTLIBS_PATH)/wii/include/SDL -I$(PORTLIBS_PATH)/ppc/include/freetype2
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB)
export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -j4 -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol
#---------------------------------------------------------------------------------
run:
wiiload $(OUTPUT).dol
#---------------------------------------------------------------------------------
reload:
wiiload -r $(OUTPUT).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 .ttf, .png, and .mp3 extensions
#---------------------------------------------------------------------------------
%.ttf.o %_ttf.h : %.ttf
@echo $(notdir $<)
$(bin2o)
%.lang.o %_lang.h : %.lang
@echo $(notdir $<)
$(bin2o)
%.png.o %_png.h : %.png
@echo $(notdir $<)
$(bin2o)
%.ogg.o %_ogg.h : %.ogg
@echo $(notdir $<)
$(bin2o)
%.pcm.o %_pcm.h : %.pcm
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

View File

@ -1573,9 +1573,17 @@ bool GFX_IsFullscreen(void) {
void GFX_Events() {
#ifdef HW_RVL
#ifdef OLD_LIBS
// nothing to do
// on old libogc version it looks like it also works without
// and extra scan call.
#else
// Very important to update/scan the current pad/button states.
// Otherwise on newer libogc versions the button states are not updated.
WPAD_ScanPads();
PAD_ScanPads();
#endif
// check for home button
u32 btns;

View File

@ -11,7 +11,10 @@
#include <math.h>
#include <float.h>
#include <stdlib.h>
#ifndef OLD_LIBS // for old devkitppc memory.h is not included
#include <memory.h>
#endif
#if C_DEBUG
#include <stdio.h>

View File

@ -7,6 +7,10 @@
#ifndef MAME_SOUND_SAA1099_H
#define MAME_SOUND_SAA1099_H
#ifdef OLD_LIBS
#include <string.h>
#endif
#pragma once
//**************************************************************************

View File

@ -58,6 +58,9 @@ differences between OPL2 and OPL3 shown in datasheets:
#include "emu.h"
#include "ymf262.h"
#ifdef OLD_LIBS
#include <string.h>
#endif
/* output final shift */
#if (OPL3_SAMPLE_BITS==16)

View File

@ -11,6 +11,102 @@
#ifndef _FILELIST_H_
#define _FILELIST_H_
#ifdef OLD_LIBS
#include <gccore.h>
extern const u8 font_ttf[];
extern const u32 font_ttf_size;
extern const u8 enter_ogg[];
extern const u32 enter_ogg_size;
extern const u8 exit_ogg[];
extern const u32 exit_ogg_size;
extern const u8 button_over_pcm[];
extern const u32 button_over_pcm_size;
extern const u8 button_click_pcm[];
extern const u32 button_click_pcm_size;
extern const u8 logo_png[];
extern const u32 logo_png_size;
extern const u8 logo_over_png[];
extern const u32 logo_over_png_size;
extern const u8 bg_top_png[];
extern const u32 bg_top_png_size;
extern const u8 bg_bottom_png[];
extern const u32 bg_bottom_png_size;
extern const u8 button_png[];
extern const u32 button_png_size;
extern const u8 button_over_png[];
extern const u32 button_over_png_size;
extern const u8 button_small_png[];
extern const u32 button_small_png_size;
extern const u8 button_small_over_png[];
extern const u32 button_small_over_png_size;
extern const u8 button_large_png[];
extern const u32 button_large_png_size;
extern const u8 button_large_over_png[];
extern const u32 button_large_over_png_size;
extern const u8 battery_png[];
extern const u32 battery_png_size;
extern const u8 battery_red_png[];
extern const u32 battery_red_png_size;
extern const u8 battery_bar_png[];
extern const u32 battery_bar_png_size;
extern const u8 credits_box_png[];
extern const u32 credits_box_png_size;
extern const u8 keyboard_textbox_png[];
extern const u32 keyboard_textbox_png_size;
extern const u8 keyboard_key_png[];
extern const u32 keyboard_key_png_size;
extern const u8 keyboard_key_over_png[];
extern const u32 keyboard_key_over_png_size;
extern const u8 keyboard_mediumkey_png[];
extern const u32 keyboard_mediumkey_png_size;
extern const u8 keyboard_mediumkey_over_png[];
extern const u32 keyboard_mediumkey_over_png_size;
extern const u8 keyboard_largekey_png[];
extern const u32 keyboard_largekey_png_size;
extern const u8 keyboard_largekey_over_png[];
extern const u32 keyboard_largekey_over_png_size;
extern const u8 player1_point_png[];
extern const u32 player1_point_png_size;
extern const u8 player2_point_png[];
extern const u32 player2_point_png_size;
extern const u8 player3_point_png[];
extern const u32 player3_point_png_size;
extern const u8 player4_point_png[];
extern const u32 player4_point_png_size;
#else
#include "font_ttf.h"
#include "enter_ogg.h"
@ -53,3 +149,5 @@
#include "player4_point_png.h"
#endif
#endif

View File

@ -149,7 +149,11 @@ static void * PressKeys (void *arg)
static bool gecko = false;
static mutex_t gecko_mutex = 0;
#ifdef OLD_LIBS
static ssize_t __out_write(struct _reent *r, int fd, const char *ptr, size_t len)
#else
static ssize_t __out_write(struct _reent *r, void* fd, const char *ptr, size_t len)
#endif
{
u32 level;