Skip to content

Commit 40e4479

Browse files
authored
Merge pull request #85 from jtothebell/Sdl12Rebased
Add bittboy miyoo and SDL 1.2 build
2 parents f443f19 + 9f297f9 commit 40e4479

File tree

9 files changed

+846
-10
lines changed

9 files changed

+846
-10
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ platform/vita/eboot.bin
3535
platform/vita/*.velf
3636
platform/vita/*.vpk
3737
platform/vita/param.sfo
38+
platform/SDL1_2/FAKE08
39+
platform/bittboy/FAKE08

Makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ export APP_AUTHOR = jtothebell
77
export V_MAJOR = 0
88
export V_MINOR = 0
99
export V_PATCH = 2
10-
export V_BUILD = 11
10+
export V_BUILD = 12
1111
export APP_VERSION = v$(V_MAJOR).$(V_MINOR).$(V_PATCH).$(V_BUILD)
1212

1313

1414
#paths are relative to platform folder
1515
export SOURCES = ../../source ../../libs/z8lua ../../libs/utf8-util ../../libs/lodepng ../../libs/simpleini
1616
export INCLUDES = ../../include ../../libs/z8lua ../../libs/utf8-util ../../libs/lodepng ../../libs/simpleini
1717

18-
.PHONY: all 3ds switch wiiu vita sdl2 clean clean-3ds clean-switch clean-wiiu clean-vita clean-sdl2
18+
.PHONY: all 3ds switch wiiu vita sdl2 sdl clean clean-3ds clean-switch clean-wiiu clean-vita clean-sdl2 clean-sdl
1919

20-
all: 3ds switch wiiu sdl2
20+
all: 3ds switch wiiu vita bittboy
2121

22-
clean: clean-tests clean-3ds clean-switch clean-wiiu clean-vita clean-sdl2
22+
clean: clean-tests clean-3ds clean-switch clean-wiiu clean-vita clean-sdl2 clean-sdl clean-bittboy
2323

2424
clean-3ds:
2525
@$(MAKE) -C platform/3ds clean
@@ -36,6 +36,12 @@ clean-vita:
3636
clean-sdl2:
3737
@$(MAKE) -C platform/SDL2Desktop clean
3838

39+
clean-sdl:
40+
@$(MAKE) -C platform/SDL1_2 clean
41+
42+
clean-bittboy:
43+
@$(MAKE) -C platform/bittboy clean
44+
3945
3ds:
4046
@$(MAKE) -C platform/3ds
4147

@@ -54,6 +60,12 @@ vita:
5460
sdl2:
5561
@$(MAKE) -C platform/SDL2Desktop
5662

63+
sdl:
64+
@$(MAKE) -C platform/SDL1_2
65+
66+
bittboy:
67+
@$(MAKE) -C platform/bittboy
68+
5769
clean-tests:
5870
@$(MAKE) -C test clean
5971

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# fake-08
22

3-
A Pico 8 player for homebrew consoles. Not related to or supported by Lexaloffle Software. [Latest release](https://github.com/jtothebell/fake-08/releases) includes releases for Nintendo 3DS, Nintendo Switch, Sony PS Vita, and Nintendo Wii U. If you are feeling extra brave, you can also download build aftifacts from the latest CI runs in the [Actions section](https://github.com/jtothebell/fake-08/actions)
3+
A Pico 8 player for homebrew consoles. Not related to or supported by Lexaloffle Software. [Latest release](https://github.com/jtothebell/fake-08/releases) includes releases for Nintendo 3DS, Nintendo Switch, Sony PS Vita, Nintendo Wii U, and the Miyoo CFW for bittboy and similar consoles. If you are feeling extra brave, you can also download build aftifacts from the latest CI runs in the [Actions section](https://github.com/jtothebell/fake-08/actions)
44

55
## Usage:
66
Installation will vary by console and executable type. If it is a console with a homebrew menu (Switch, Wii U, 3DS using .3dsx), place the executable file in the directory with other executables. If it is a console with installable hombrew (3ds with .cia, or PS Vita) install executable (VitaShell on Vita or FBI on 3DS).
@@ -9,8 +9,10 @@ Pico 8 cart files go in the `p8carts/` directory of your memory card (SD card on
99

1010
Launch FAKE-08 either via the homebrew menu or normal system UI (depending on how you installed). Use left and right to cycle through carts on the SD card. Choose a cart using the `A` (Nintendo consoles) or `X`(Vita) button. To exit the currently running cart, press `Start` or `+` to open the pause menu and select `Exit to Menu`. Press `R` to cycle between rendering sizes. Press `L` and `R` simultaneously to exit the appication. You can also close it via your console's operating system controls (home button etc).
1111

12+
For bittboy and similar consoles, back up `emus/pico8/pico8.elf` and replace it with the one from the release. Place your cart files in `roms/pico-8/` and use the front end of choice to launch games. Press the menu button to return to the menu (though you can also press start and exit to the FAKE-08 bios menu if you would like).
13+
1214
## Building:
13-
All platforms have automated builds set up via GitHub actions using docker images. You can see how those are set up in the `.github/workflows` directory of the repo.
15+
All platforms (except bittboy currently) have automated builds set up via GitHub actions using docker images. You can see how those are set up in the `.github/workflows` directory of the repo.
1416

1517
Building outside of a pre-setup docker container will require a toolchain installation for the platform that you want to build.
1618

@@ -22,12 +24,14 @@ Once you have the appropriate toolchain(s) installed, call `make` followed by th
2224

2325
Building tested on windows using devkitpro's msys2 and Ubuntu (WSL and standalone). Should work on other plaforms as well.
2426

27+
Building for bittboy requires builing your own toolchain first (and will probably only work on unix.). The toolchain is available at https://github.com/bittboy/buildroot/. Clone and build that repo, then recursively copy the contents of `/output/host/` to `/opt/miyoo/`. You should then be able to use the `make bittboy` command.
28+
2529
## Acknowledgements
2630
* Zep/Lexaloffle software for making pico 8. Buy a copy if you can. You won't regret it. https://www.lexaloffle.com/pico-8.php
2731
* Nintendo Homebrew Community
2832
* Vita Homebrew Community
2933
* zepto8 (https://github.com/samhocevar/zepto8) - Probably the best Pico 8 emulator. FAKE-08's audio, tline, emoji conversion, and newer png decompression implementations were ported from zepto8, and other parts were heavily influenced. I also use a slightly modified z8lua (https://github.com/samhocevar/z8lua) for pico 8 specific features.
30-
* PicoLove (https://github.com/gamax92/picolove) - basis for my previous project - PicoLovePotion - and where I first learned the basics of Pico 8's API
34+
* PicoLove (https://github.com/gamax92/picolove) - Noise synthesis ported from this Pico Love, and it was also the basis for my previous project - PicoLovePotion - and where I first learned the basics of Pico 8's API
3135
* tac08 (https://github.com/0xcafed00d/tac08) - a Pico 8 emulator that I leared a lot from. FAKE-08's sprite rendering and cart parsing were originally based on tac08's implementations
3236
* LovePotion (https://github.com/TurtleP/LovePotion) - an implementation of Love2d for 3DS and switch that served as the runtime for PicoLovePotion, and a great way to make homebrew games for the 3DS and switch. I also use a modified version of their static Logger implementation
3337

@@ -39,9 +43,9 @@ Latest Pico 8 version v0.2.2 features (sprite fill patterns, text control codes,
3943

4044
Games using `flip()` (like tweetcarts) have intermittent problems exiting back to the menu, and may crash the console. Use with caution.
4145

42-
Sound emulation is missing effects, and the noise implementation is wildly inaccurrate. Most of my sound implementation was ported over from Zepto 8 (which has better sound emulation) but I didn't want to bring over dependencies that were needed for those parts, and haven't otherwise implemented them yet
46+
Sound emulation is not perfect, and the noise implementation is noticably inaccurrate. Most of my sound implementation was ported over from Zepto 8. with the exception of the Noise instrument which was ported from PicoLove. It is not 100% accurate, and some games have noticable clipping/popping.
4347

44-
Performance is not great on Old 3ds systems. Some games may experience slowdowns on the faster consoles as well. More optimizations are probably possible, but keep in mind that Pico 8 lists a raspberry pi 1 with a 700 MHz ARM11 professor as minimum spec, and the old 3DS's CPU is 268 MHz ARM11. Many games should be playable regardless.
48+
Performance is not great on Old 3ds systems. Some games may experience slowdowns on the faster consoles as well. More optimizations are probably possible, but keep in mind that Pico 8 lists a raspberry pi 1 with a 700 MHz ARM11 professor as minimum spec, and the old 3DS's CPU is 268 MHz ARM11. Many games should be playable regardless, and hopefully more optimizations can be made.
4549

4650
See [Issues](https://github.com/jtothebell/fake-08/issues) page for more specifics
4751

platform/SDL1_2/Makefile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
2+
#---------------------------------------------------------------------------------
3+
# TARGET is the name of the output
4+
# BUILD is the directory where object files & intermediate files will be placed
5+
# SOURCES is a list of directories containing source code
6+
# INCLUDES is a list of directories containing header files
7+
#
8+
#---------------------------------------------------------------------------------
9+
TARGET := FAKE08
10+
BUILD := build
11+
SOURCES := ${SOURCES} ../bittboy/source source
12+
INCLUDES := ${INCLUDES}
13+
14+
#---------------------------------------------------------------------------------
15+
# options for code generation
16+
#---------------------------------------------------------------------------------
17+
CC = $(CXX)
18+
19+
CFLAGS := -g -Wall -ffunction-sections -DVER_STR=\"$(APP_VERSION)\" \
20+
$(DEFINES)
21+
22+
CFLAGS += $(INCLUDE)
23+
24+
CXXFLAGS := $(CFLAGS) -fno-rtti -std=gnu++17
25+
26+
LIBS := -lSDL
27+
28+
LDFLAGS := $(LIBS)
29+
30+
31+
#---------------------------------------------------------------------------------
32+
# no real need to edit anything past this point unless you need to add additional
33+
# rules for different file extensions
34+
#---------------------------------------------------------------------------------
35+
ifneq ($(BUILD),$(notdir $(CURDIR)))
36+
#---------------------------------------------------------------------------------
37+
38+
export OUTPUT := $(CURDIR)/$(TARGET)
39+
export TOPDIR := $(CURDIR)
40+
41+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
42+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
43+
44+
export DEPSDIR := $(CURDIR)/$(BUILD)
45+
46+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
47+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
48+
49+
#---------------------------------------------------------------------------------
50+
# use CXX for linking C++ projects, CC for standard C
51+
#---------------------------------------------------------------------------------
52+
ifeq ($(strip $(CPPFILES)),)
53+
#---------------------------------------------------------------------------------
54+
export LD := $(CC)
55+
#---------------------------------------------------------------------------------
56+
else
57+
#---------------------------------------------------------------------------------
58+
export LD := $(CXX)
59+
#---------------------------------------------------------------------------------
60+
endif
61+
#---------------------------------------------------------------------------------
62+
63+
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
64+
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
65+
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
66+
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
67+
68+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
69+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
70+
-I$(CURDIR)/$(BUILD)
71+
72+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
73+
74+
75+
.PHONY: $(BUILD) clean all
76+
77+
#---------------------------------------------------------------------------------
78+
all: $(BUILD)
79+
80+
$(BUILD):
81+
@[ -d $@ ] || mkdir -p $@
82+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
83+
84+
#---------------------------------------------------------------------------------
85+
clean:
86+
@echo clean ...
87+
@rm -fr $(BUILD) $(TARGET)
88+
89+
90+
#---------------------------------------------------------------------------------
91+
else
92+
.PHONY: all
93+
94+
DEPENDS := $(OFILES:.o=.d)
95+
96+
#---------------------------------------------------------------------------------
97+
# main targets
98+
#---------------------------------------------------------------------------------
99+
all : $(OUTPUT)
100+
101+
$(OUTPUT) : $(OFILES)
102+
$(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
103+
104+
$(OFILES_SRC) : $(HFILES_BIN)
105+
106+
#---------------------------------------------------------------------------------
107+
# you need a rule like this for each extension you use as binary data
108+
#---------------------------------------------------------------------------------
109+
%.bin.o %_bin.h : %.bin
110+
#---------------------------------------------------------------------------------
111+
@echo $(notdir $<)
112+
@$(bin2o)
113+
114+
-include $(DEPENDS)
115+
116+
#---------------------------------------------------------------------------------------
117+
endif
118+
#---------------------------------------------------------------------------------------

platform/bittboy/Makefile

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
2+
#---------------------------------------------------------------------------------
3+
# TARGET is the name of the output
4+
# BUILD is the directory where object files & intermediate files will be placed
5+
# SOURCES is a list of directories containing source code
6+
# INCLUDES is a list of directories containing header files
7+
#
8+
#---------------------------------------------------------------------------------
9+
TARGET := FAKE08
10+
BUILD := build
11+
SOURCES := ${SOURCES} source
12+
INCLUDES := ${INCLUDES}
13+
14+
#---------------------------------------------------------------------------------
15+
# options for code generation
16+
#---------------------------------------------------------------------------------
17+
18+
BIN_BASE = /opt/miyoo/bin/
19+
20+
CC = $(BIN_BASE)arm-linux-gcc
21+
CXX = $(BIN_BASE)arm-linux-g++
22+
23+
CC = $(CXX)
24+
25+
CFLAGS := -g -Wall -Ofast -ffunction-sections -Iinc -D_BITTBOY -DVER_STR=\"$(APP_VERSION)\" -march=armv5te -mtune=arm926ej-s \
26+
$(DEFINES)
27+
28+
CFLAGS += $(INCLUDE)
29+
30+
CXXFLAGS := $(CFLAGS) -fno-rtti -std=gnu++17
31+
32+
LIBS := -s $(shell $(BIN_BASE)pkg-config --libs sdl) -lSDL
33+
34+
LDFLAGS := $(LIBS)
35+
36+
37+
#---------------------------------------------------------------------------------
38+
# no real need to edit anything past this point unless you need to add additional
39+
# rules for different file extensions
40+
#---------------------------------------------------------------------------------
41+
ifneq ($(BUILD),$(notdir $(CURDIR)))
42+
#---------------------------------------------------------------------------------
43+
44+
export OUTPUT := $(CURDIR)/$(TARGET)
45+
export TOPDIR := $(CURDIR)
46+
47+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
48+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
49+
50+
export DEPSDIR := $(CURDIR)/$(BUILD)
51+
52+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
53+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
54+
55+
#---------------------------------------------------------------------------------
56+
# use CXX for linking C++ projects, CC for standard C
57+
#---------------------------------------------------------------------------------
58+
ifeq ($(strip $(CPPFILES)),)
59+
#---------------------------------------------------------------------------------
60+
export LD := $(CC)
61+
#---------------------------------------------------------------------------------
62+
else
63+
#---------------------------------------------------------------------------------
64+
export LD := $(CXX)
65+
#---------------------------------------------------------------------------------
66+
endif
67+
#---------------------------------------------------------------------------------
68+
69+
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
70+
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
71+
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
72+
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
73+
74+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
75+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
76+
-I$(CURDIR)/$(BUILD)
77+
78+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
79+
80+
81+
.PHONY: $(BUILD) clean all
82+
83+
#---------------------------------------------------------------------------------
84+
all: $(BUILD)
85+
86+
$(BUILD):
87+
@[ -d $@ ] || mkdir -p $@
88+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
89+
90+
#---------------------------------------------------------------------------------
91+
clean:
92+
@echo clean ...
93+
@rm -fr $(BUILD) $(TARGET)
94+
95+
96+
#---------------------------------------------------------------------------------
97+
else
98+
.PHONY: all
99+
100+
DEPENDS := $(OFILES:.o=.d)
101+
102+
#---------------------------------------------------------------------------------
103+
# main targets
104+
#---------------------------------------------------------------------------------
105+
all : $(OUTPUT)
106+
107+
$(OUTPUT) : $(OFILES)
108+
$(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
109+
110+
$(OFILES_SRC) : $(HFILES_BIN)
111+
112+
#---------------------------------------------------------------------------------
113+
# you need a rule like this for each extension you use as binary data
114+
#---------------------------------------------------------------------------------
115+
%.bin.o %_bin.h : %.bin
116+
#---------------------------------------------------------------------------------
117+
@echo $(notdir $<)
118+
@$(bin2o)
119+
120+
-include $(DEPENDS)
121+
122+
#---------------------------------------------------------------------------------------
123+
endif
124+
#---------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)