Skip to content

Commit

Permalink
feat: The "Made with PVSnesLib" logo screen for PVSnesLib games
Browse files Browse the repository at this point in the history
  • Loading branch information
malayli committed Aug 16, 2023
1 parent 1cd51fc commit eb4a91d
Show file tree
Hide file tree
Showing 11 changed files with 412 additions and 0 deletions.
40 changes: 40 additions & 0 deletions snes-examples/logo/snes-logo-pvsneslib/Makefile
@@ -0,0 +1,40 @@
ifeq ($(strip $(PVSNESLIB_HOME)),)
$(error "Please create an environment variable PVSNESLIB_HOME with path to its folder and restart application. (you can do it on windows with <setx PVSNESLIB_HOME "/c/snesdev">)")
endif

# BEFORE including snes_rules :
# list in AUDIOFILES all your .it files in the right order. It will build to generate soundbank file
AUDIODIR := res
export AUDIOFILES := $(foreach dir, $(AUDIODIR), \
$(dir)/*.it)

# then define the path to generate soundbank data. The name can be different but do not forget to update your include in .c file !
export SOUNDBANK := soundbank

include ${PVSNESLIB_HOME}/devkitsnes/snes_rules

.PHONY: bitmaps all

#---------------------------------------------------------------------------------
# ROMNAME is used in snes_rules file
export ROMNAME := logo

# to build musics, define SMCONVFLAGS with parameters you want
SMCONVFLAGS := -s -o $(SOUNDBANK) -V -b 5
musics: $(SOUNDBANK).obj

all: musics logo $(ROMNAME).sfc

cleanGfxLogo:
@echo clean logo graphics data
@rm -f res/*.pic res/*.pal

clean: cleanBuildRes cleanRom cleanGfx cleanGfxLogo cleanAudio

#---------------------------------------------------------------------------------

logo.pic: res/logo.bmp
@echo convert font with no tile reduction ... $(notdir $@)
$(GFXCONV) -pc16 -n -gs8 -pe1 -fbmp $<

logo : logo.pic
18 changes: 18 additions & 0 deletions snes-examples/logo/snes-logo-pvsneslib/README.md
@@ -0,0 +1,18 @@
# Made With PVSnesLib Logo on SNES

## Description
This is a demo showing the "Made with PVSnesLib" logo on the Super Nintendo and Super Famicom.

## Credits
Graphics and sound made by [Lunoka](https://github.com/lunoka).
Code made by [Digifox](https://github.com/malayli).

## Preview
![preview](preview.png)

## How to build
### Visual Studio Code
- Install Visual Studio Code
- Open the root directory with Visual Studio Code
- Build: Shit+Ctrl+B
- Open logo.sfc with a SNES Emulator
13 changes: 13 additions & 0 deletions snes-examples/logo/snes-logo-pvsneslib/data.asm
@@ -0,0 +1,13 @@
.include "hdr.asm"

.section ".rodata1" superfree

logoPic:
.incbin "res/logo.pic"
logoPic_end:

logoPalette:
.incbin "res/logo.pal"
logoPalette_end:

.ends
46 changes: 46 additions & 0 deletions snes-examples/logo/snes-logo-pvsneslib/hdr.asm
@@ -0,0 +1,46 @@
;==LoRom== ; We'll get to HiRom some other time.

.MEMORYMAP ; Begin describing the system architecture.
SLOTSIZE $8000 ; The slot is $8000 bytes in size. More details on slots later.
DEFAULTSLOT 0 ; There's only 1 slot in SNES, there are more in other consoles.
SLOT 0 $8000 ; Defines Slot 0's starting address.
SLOT 1 $0 $2000
SLOT 2 $2000 $E000
SLOT 3 $0 $10000
.ENDME ; End MemoryMap definition

.ROMBANKSIZE $8000 ; Every ROM bank is 32 KBytes in size
.ROMBANKS 8 ; 2 Mbits - Tell WLA we want to use 8 ROM Banks

.SNESHEADER
ID "SNES" ; 1-4 letter string, just leave it as "SNES"

NAME "MADE WITH PVSNESLIB " ; Program Title - can't be over 21 bytes,
; "123456789012345678901" ; use spaces for unused bytes of the name.

SLOWROM
LOROM

CARTRIDGETYPE $00 ; $00 = ROM only $02 = ROM+SRAM, see WLA documentation for others
ROMSIZE $08 ; $08 = 2 Mbits, see WLA doc for more..
SRAMSIZE $00 ; $00 = No Sram, $01 = 16 kbits, see WLA doc for more..
COUNTRY $01 ; $01 = U.S. $00 = Japan, that's all I know
LICENSEECODE $00 ; Just use $00
VERSION $00 ; $00 = 1.00, $01 = 1.01, etc.
.ENDSNES

.SNESNATIVEVECTOR ; Define Native Mode interrupt vector table
COP EmptyHandler
BRK EmptyHandler
ABORT EmptyHandler
NMI VBlank
IRQ EmptyHandler
.ENDNATIVEVECTOR

.SNESEMUVECTOR ; Define Emulation Mode interrupt vector table
COP EmptyHandler
ABORT EmptyHandler
NMI EmptyHandler
RESET tcc__start ; where execution starts
IRQBRK EmptyHandler
.ENDEMUVECTOR
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
257 changes: 257 additions & 0 deletions snes-examples/logo/snes-logo-pvsneslib/src/logo.c

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions snes-examples/logo/snes-logo-pvsneslib/src/logo.h
@@ -0,0 +1,2 @@
void initPVSnesLibLogo();
u8 updatePVSnesLibLogo();
36 changes: 36 additions & 0 deletions snes-examples/logo/snes-logo-pvsneslib/src/main.c
@@ -0,0 +1,36 @@
/*---------------------------------------------------------------------------------
"Made with PVSnesLib" Logo for SNES Projects
---------------------------------------------------------------------------------*/
#include <snes.h>
#include "logo.h"

int main(void) {
// Initialize sound engine (take some time)
spcBoot();

// Initialize SNES
consoleInit();

dmaClearVram();

initPVSnesLibLogo();

setFadeEffectEx(FADE_IN, 8);
WaitForVBlank();

while (1) {
if (updatePVSnesLibLogo() == 1) {
// The logo animation is complete
// Paste your game code here
// consoleNocashMessage("Start your game!");
}

// Wait for vblank
WaitForVBlank();
}
return 0;
}

0 comments on commit eb4a91d

Please sign in to comment.