getting .dol to execute
Posted: Sat Aug 07, 2010 2:18 am
hello,
I've been trying to get my code to work, it compiles fine with no errors or warnings, but when i load it, all i see is a blank screen for a few seconds then it exits. Does anyone think that they can help with this?
my .cpp
here's my makefile:
I've been trying to get my code to work, it compiles fine with no errors or warnings, but when i load it, all i see is a blank screen for a few seconds then it exits. Does anyone think that they can help with this?
my .cpp
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <gccore.h>
#include <wiiuse/wpad.h>
#include <fat.h>
#include <vector>
#include <wiisprite.h> // The main libwiisprite header.
using namespace wsp; // To not make us type this again and again
#include "../build/board_png.h"
#include "../build/Green00_png.h"
#include "../build/Green01_png.h"
#include "../build/Green02_png.h"
#include "../build/Green10_png.h"
#include "../build/Green11_png.h"
#include "../build/Green12_png.h"
#include "../build/Green20_png.h"
#include "../build/Green21_png.h"
#include "../build/Green22_png.h"
#include "../build/Pink00_png.h"
#include "../build/Pink01_png.h"
#include "../build/Pink02_png.h"
#include "../build/Pink10_png.h"
#include "../build/Pink11_png.h"
#include "../build/Pink12_png.h"
#include "../build/Pink20_png.h"
#include "../build/Pink21_png.h"
#include "../build/Pink22_png.h"
int main(int argc, char **argv)
{
// Create the game window and initalise the VIDEO subsystem
GameWindow gwd;
gwd.InitVideo();
gwd.SetBackground((GXColor){ 255, 255, 255, 255 });
///////////////////////////////////////////////////////////////////////////////////////////////
// A huge set of statements that should be in a seperate function lines 45-151
///////////////////////////////////////////////////////////////////////////////////////////////
LayerManager manager(5);
//load images
Image bg;
Image g00, p00;
Image g01, p01;
Image g02, p02;
Image g10, p10;
Image g11, p11;
Image g12, p12;
Image g20, p20;
Image g21, p21;
Image g22, p22;
Sprite sbg, sg00, sp00, sg01, sp01, sg02, sp02, sg10, sp10, sg11,
sp11, sg12, sp12, sg20, sp20, sg21, sp21, sg22, sp22;
std::vector<Sprite> vsprites;
if( bg.LoadImage(board_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g00.LoadImage(Green00_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g01.LoadImage(Green01_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g02.LoadImage(Green02_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g10.LoadImage(Green10_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g11.LoadImage(Green11_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g12.LoadImage(Green12_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g20.LoadImage(Green20_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g21.LoadImage(Green21_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( g22.LoadImage(Green22_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p00.LoadImage(Pink00_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p01.LoadImage(Pink01_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p02.LoadImage(Pink02_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p10.LoadImage(Pink10_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p11.LoadImage(Pink11_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p12.LoadImage(Pink12_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p20.LoadImage(Pink20_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p21.LoadImage(Pink21_png) != IMG_LOAD_ERROR_NONE)exit(0);
if( p22.LoadImage(Pink22_png) != IMG_LOAD_ERROR_NONE)exit(0);
sbg.SetImage(&bg);
sbg.SetPosition(0,0);
sg00.SetImage(&g00);
sg00.SetPosition(106.75, 80.5);
sp00.SetImage(&p00);
sp00.SetPosition(106.75, 80.5);
sg01.SetImage(&g01);
sg01.SetPosition(319.83, 80.5);
sp01.SetImage(&p01);
sp01.SetPosition(319.83, 80.5);
sg02.SetImage(&g02);
sg02.SetPosition(523.83, 80.17);
sp02.SetImage(&p02);
sp02.SetPosition(523.83, 80.17);
sg10.SetImage(&g10);
sg10.SetPosition(107.17, 241.17);
sp10.SetImage(&p10);
sp10.SetPosition(107.17, 241.17);
sg11.SetImage(&g11);
sg11.SetPosition(320.29, 241.33);
sp11.SetImage(&p11);
sp11.SetPosition(320.29, 241.33);
sg12.SetImage(&g12);
sg12.SetPosition(532.96, 241.17);
sp12.SetImage(&p12);
sp12.SetPosition(532.96, 241.17);
sg20.SetImage(&g20);
sg20.SetPosition(107.46, 399.83);
sp20.SetImage(&p20);
sp20.SetPosition(107.46, 399.83);
sg21.SetImage(&g21);
sg21.SetPosition(320.13, 399.75);
sp21.SetImage(&p21);
sp21.SetPosition(320.13, 399.75);
sg22.SetImage(&g22);
sg22.SetPosition(532.92, 400.04);
sp22.SetImage(&p22);
sp22.SetPosition(532.92, 400.04);
vsprites.push_back(sbg);
vsprites.push_back(sg00);
vsprites.push_back(sp00);
vsprites.push_back(sg01);
vsprites.push_back(sp01);
vsprites.push_back(sg02);
vsprites.push_back(sp02);
vsprites.push_back(sg10);
vsprites.push_back(sp10);
vsprites.push_back(sg11);
vsprites.push_back(sp11);
vsprites.push_back(sg12);
vsprites.push_back(sp12);
vsprites.push_back(sg20);
vsprites.push_back(sp20);
vsprites.push_back(sg21);
vsprites.push_back(sp21);
vsprites.push_back(sg22);
vsprites.push_back(sp22);
Sprite temp;
for(int i=0;i<vsprites.size();i++)
{
Sprite temp = vsprites[i];
manager.Append(&temp);
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
while(1)
{
manager.Draw(0,0);
WPAD_Init();
for(;;)
{
WPAD_ScanPads();
if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME)
break;
gwd.Flush();
}
}
return 0;
}
Code: Select all
#---------------------------------------------------------------------------------
# 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 := boot
BUILD := build
SOURCES := source
INCLUDES := include
DATA := data
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -I$(DEVKITPPC)/local/include
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lwiisprite -lpng -lz -lwiiuse -lbte -lfat -logc -lm
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(DEVKITPRO)/libogc/libs
#---------------------------------------------------------------------------------
# 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 := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o)
#---------------------------------------------------------------------------------
# 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)
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB) -L$(DEVKITPRO)/libogc/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)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.jpg.o : %.jpg
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o : %.png
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .mp3 extension
#---------------------------------------------------------------------------------
%.mp3.o : %.mp3
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
# This rule links in binary data
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
%.mod.o : %.mod
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------