tangstad/helds
tangstad
/
helds
Archived
1
0
Fork 0

Imported PCXView example from devkitpro to be used for helds logo splashscreen.

This commit is contained in:
Truls Alexander Tangstad 2005-11-07 18:45:21 +00:00
parent e0a6821d19
commit 81c5944d18
8 changed files with 408 additions and 0 deletions

137
gba/logosplash/Makefile Normal file
View File

@ -0,0 +1,137 @@
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM)
endif
include $(DEVKITARM)/gba_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output, if this ends with _mb generates a multiboot image
# 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 := PCXView_mb
BUILD := build
SOURCES := src data
INCLUDES :=
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -mthumb -mthumb-interwork
CFLAGS := -g -Wall -O0\
-mcpu=arm7tdmi -mtune=arm7tdmi\
-fomit-frame-pointer\
-ffast-math \
$(ARCH)
CFLAGS += $(INCLUDE)
ASFLAGS := $(ARCH)
LDFLAGS = -g $(ARCH) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# path to tools - this can be deleted if you set the path in windows
#---------------------------------------------------------------------------------
export PATH := $(DEVKITARM)/bin:$(PATH)
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lgba
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(LIBGBA)
#---------------------------------------------------------------------------------
# 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))
export PATH := $(DEVKITARM)/bin:$(PATH)
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)))
PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES := $(PCXFILES:.pcx=.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.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)
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
.PHONY: $(BUILD) clean
#---------------------------------------------------------------------------------
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
all : $(BUILD)
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).elf $(TARGET).gba
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).gba : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
%.o : %.pcx
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

109
gba/logosplash/PCXView.dsp Normal file
View File

@ -0,0 +1,109 @@
# Microsoft Developer Studio Project File - Name="PCXView" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) External Target" 0x0106
CFG=PCXView - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "PCXView.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "PCXView.mak" CFG="PCXView - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "PCXView - Win32 Release" (based on "Win32 (x86) External Target")
!MESSAGE "PCXView - Win32 Debug" (based on "Win32 (x86) External Target")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
!IF "$(CFG)" == "PCXView - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Cmd_Line "NMAKE /f PCXView.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "PCXView.exe"
# PROP BASE Bsc_Name "PCXView.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Cmd_Line "make -r 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):/\1(\2):/'"
# PROP Rebuild_Opt ""
# PROP Target_File "PCXView.gba"
# PROP Bsc_Name ""
# PROP Target_Dir ""
!ELSEIF "$(CFG)" == "PCXView - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Cmd_Line "NMAKE /f PCXView.mak"
# PROP BASE Rebuild_Opt "/a"
# PROP BASE Target_File "PCXView.exe"
# PROP BASE Bsc_Name "PCXView.bsc"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Cmd_Line "make -r 2>&1 | sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):/\1(\2):/'"
# PROP Rebuild_Opt ""
# PROP Target_File "PCXView.gba"
# PROP Bsc_Name ""
# PROP Target_Dir ""
!ENDIF
# Begin Target
# Name "PCXView - Win32 Release"
# Name "PCXView - Win32 Debug"
!IF "$(CFG)" == "PCXView - Win32 Release"
!ELSEIF "$(CFG)" == "PCXView - Win32 Debug"
!ENDIF
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\src\pcx_view.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\data\splash.pcx
# End Source File
# End Group
# Begin Source File
SOURCE=.\Makefile
# End Source File
# End Target
# End Project

View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "PCXView"=.\PCXView.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -0,0 +1 @@
<Project name="template"><MagicFolder excludeFolders="CVS;.svn" filter="*.h" name="include" path="include\"></MagicFolder><MagicFolder excludeFolders="CVS;.svn" filter="*.c;*.cpp" name="source" path="src\"><File path="pcx_view.c"></File></MagicFolder><File path="Makefile"></File></Project>

View File

@ -0,0 +1,69 @@
[Project ID]
Signature=UE Proj: v.1
[Project Information]
Filter=*.*
Project Directory=C:\projects\gba\DevkitSamples\PCXView\
Use Relative Directory=1
Relative to Project File=1
Project Wordfile=
Project Tagfile=
Create Tagfile=0
Include Sub Directories=0
[Open Files]
Open File0=
Open File Pos0=0
Open File Line0=0
Active File Index=2
Open File Window Pos0=0,1,-1,-1,-4,-23,88,88,998,447
Open File1=C:\projects\devkitPro\libnds\source\common\interrupts.c
Open File Pos1=1024
Open File Line1=0
Open File Window Pos1=0,1,-1,-1,-4,-23,110,110,1024,473
Open File2=C:\projects\devkitPro\libnds\include\nds\interrupts.h
Active File Display Mode=-1
Open File Pos2=2410
Open File Line2=2658
Open File Window Pos2=2,3,-1,-1,-4,-23,132,132,1046,495
Open File3=C:\projects\devkitPro\libgba\include\gba_interrupt.h
Open File Pos3=2165
Open File Line3=1256
Open File Window Pos3=0,1,-1,-1,-4,-23,154,154,1068,517
Open File4=C:\projects\devkitPro\libgba\src\interrupt.c
Open File Pos4=0
Open File Line4=1076
Open File Window Pos4=0,1,-1,-1,-4,-23,0,0,914,363
Open File5=
Open File Pos5=32
Open File Line5=0
Open File Window Pos5=2,3,-1,-1,-4,-23,132,132,1009,576
Open File6=C:\projects\devkitPro\buildscripts\dka-crtls\ds_cart_crt0.s
Open File Pos6=1793
Open File Line6=1450
Open File Window Pos6=0,1,-1,-1,-4,-23,154,154,1031,598
Open File7=C:\projects\devkitPro\buildscripts\dka-crtls\ds_arm9_crt0.s
Open File Pos7=679
Open File Line7=0
Open File Window Pos7=0,1,-1,-1,-4,-23,176,176,1053,620
Open File8=C:\projects\devkitPro\buildscripts\dka-crtls\ds_arm9.ld
Open File Pos8=2954
Open File Line8=2479
Open File Window Pos8=0,1,-1,-1,-4,-23,198,198,1075,642
Open File9=
Open File Pos9=0
Open File Line9=1839
Open File Window Pos9=0,1,-1,-1,-4,-23,88,88,782,357
Open File10=C:\projects\mingw\gcc\devkitbuild\newlib-1.12.0\libgloss\README
Open File Pos10=0
Open File Line10=0
Open File Window Pos10=2,3,-1,-1,-4,-23,110,110,804,379
Open File11=
[File View]
Current Select=Project Files\source\src\pcx_view.c
Scroll Position=0
[Group]
0=source
1=
[Files - source]
0=src\pcx_view.c
[Files]
0=Makefile

BIN
gba/logosplash/PCXView.tws Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,63 @@
//---------------------------------------------------------------------------------
// GBA PCXView sample code for devkitARM - http://www.devkit.tk
// Suitable for a splash screen for a game
//---------------------------------------------------------------------------------
#include "gba_video.h"
#include "gba_systemcalls.h"
#include "gba_input.h"
#include "gba_interrupt.h"
#include "pcx.h"
#include "fade.h"
#include <stdlib.h>
//---------------------------------------------------------------------------------
// header for binary data generated by bin2o macro in makefile
//---------------------------------------------------------------------------------
#include "splash_pcx.h"
//---------------------------------------------------------------------------------
// storage space for palette data
//---------------------------------------------------------------------------------
u16 PaletteBuffer[256];
unsigned int frame;
//---------------------------------------------------------------------------------
void VblankInterrupt()
//---------------------------------------------------------------------------------
{
frame += 1;
ScanKeys();
}
//---------------------------------------------------------------------------------
// Program entry point
//---------------------------------------------------------------------------------
int main(void)
//---------------------------------------------------------------------------------
{
// Set up the interrupt handlers
InitInterrupt();
SetInterrupt( IE_VBL, VblankInterrupt);
// Enable Vblank Interrupt to allow VblankIntrWait
EnableInterrupt(IE_VBL);
// Allow Interrupts
REG_IME = 1;
SetMode( MODE_4 | BG2_ON ); // screen mode & background to display
DecodePCX(splash_pcx, (u16*)VRAM , PaletteBuffer);
FadeToPalette( PaletteBuffer, 60);
while (1)
{
VBlankIntrWait();
}
}