Skip to content

Commit

Permalink
Add initial port to GCW0
Browse files Browse the repository at this point in the history
  • Loading branch information
m45t3r committed Oct 17, 2020
1 parent b5530c7 commit a9382e5
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ OFLAGS = -Ofast -march=armv5te -mtune=arm926ej-s -marm \
-Wall

ifeq ($(PGO), GENERATE)
OFLAGS += -fprofile-generate -fprofile-dir=./profile
OFLAGS += -fprofile-generate -fprofile-dir=/media/data/profile/snes9x4d
LDFLAGS += -lgcov
else ifeq ($(PGO), APPLY)
OFLAGS += -fprofile-use -fprofile-dir=./profile -fbranch-probabilities
Expand Down
92 changes: 92 additions & 0 deletions Makefile.gcw0
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
UNZIP = 1
C4_OLD = 0
SRTC = 0
CHEATS = 0
SDLMENU = 1
SETA_DSP = 0
SNAPSHOT_OLD = 0
SPC7110 = 0

include Makefile.common

PREFIX = mipsel-linux

CXX = $(PREFIX)-g++
CC = $(PREFIX)-gcc
STRIP = $(PREFIX)-strip
AS = $(PREFIX)-as

SYSROOT := $(shell $(CC) --print-sysroot)
SDL_CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
SDL_LIBS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs)

LDFLAGS = -lz -lm $(SDL_LIBS) -Wl,--as-needed -Wl,--gc-sections -s

OFLAGS = -Ofast -fomit-frame-pointer -mips32r2 \
-fdata-sections -ffunction-sections \
-fno-stack-protector -fomit-frame-pointer \
-fno-strict-aliasing \
-Wall

ifeq ($(PGO), GENERATE)
OFLAGS += -fprofile-generate -fprofile-dir=/media/data/profile/snes9x4d
LDFLAGS += -lgcov
else ifeq ($(PGO), APPLY)
OFLAGS += -fprofile-use -fprofile-dir=./profile -fbranch-probabilities
else ifeq ($(PGO), FORCE-APPLY)
OFLAGS += -fprofile-use -fprofile-dir=./profile -fbranch-probabilities -Wno-error=coverage-mismatch
else
OFLAGS += -falign-functions=1 -falign-jumps=1 -falign-loops=1 \
-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
-fmerge-all-constants
endif

CCFLAGS += $(OFLAGS) \
-DBILINEAR_SCALE \
-DFAST_LSB_WORD_ACCESS \
-DFOREVER_16_BIT \
-DFOREVER_16_BIT_SOUND \
-DLAGFIX \
-DDINGOO \
-DVIDEO_MODE=1 \
-DZLIB \

CXXFLAGS = --std=gnu++14 $(CCFLAGS) \
-fno-exceptions -fno-rtti -fno-threadsafe-statics

CFLAGS = --std=gnu11 $(CCFLAGS)

.SUFFIXES: .o .cpp .c .cc .h .m .i .S .asm .obj
.PHONY: format

all: snes9x4d

format:
find . -regex '.*\.\(c\|h\|cpp\|hpp\|cc\|cxx\)' -exec clang-format -style=file -i {} \;

snes9x4d: $(OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
$(STRIP) $@

.cpp.o:
$(CXX) -c $(CXXFLAGS) $*.cpp -o $@

.c.o:
$(CC) -c $(CFLAGS) $*.c -o $@

.cpp.S:
$(CXX) -S $(CXXFLAGS) $*.cpp -o $@

.cpp.i:
$(CXX) -E $(CXXFLAGS) $*.cpp -o $@

.S.o:
$(CXX) -c $(CXXFLAGS) $*.S -o $@

.S.i:
$(CXX) -c -E $(CXXFLAGS) $*.S -o $@

clean:
rm -f $(OBJECTS)

release: clean all
12 changes: 12 additions & 0 deletions opk/default.gcw0.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Desktop Entry]
Name=snes9x4d
Comment=Super Nintendo emulator
Comment[fr]=Émulateur de Super Nintendo
Comment[es]=Emulador de Super Nintendo
Exec=snes9x4d %f
Terminal=false
Type=Application
StartupNotify=true
Icon=sfc
Categories=emulators;
MimeType=application/x-snes-rom;application/zip;
15 changes: 15 additions & 0 deletions opk/make_opk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

cd $(dirname $0)

OPK_NAME=snes9x4d.opk

echo Building ${OPK_NAME}...

# create opk
FLIST="../snes9x4d default.gcw0.desktop sfc.png"

rm -f ${OPK_NAME}
mksquashfs ${FLIST} ${OPK_NAME} -all-root -no-xattrs -noappend -no-exports

cat default.gcw0.desktop
Binary file added opk/sfc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a9382e5

Please sign in to comment.