From b573d4ac1108e58b367127780a30c3d50d2523a9 Mon Sep 17 00:00:00 2001 From: m45t3r Date: Thu, 12 Nov 2020 00:20:12 -0300 Subject: Fix compilation with modern GCC, remove unused portaudio.h --- shell/emu/main.h | 1 - shell/input/sdl/input.c | 3 +-- shell/other/compatibility_layer.c | 1 - source/apu.c | 2 +- source/apu.h | 4 ++-- source/cpuops.c | 2 +- source/soundux.h | 4 ++-- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/shell/emu/main.h b/shell/emu/main.h index 43688c3..8bf6c42 100644 --- a/shell/emu/main.h +++ b/shell/emu/main.h @@ -1,7 +1,6 @@ #ifndef MAIN_H #define MAIN_H -int ResumeEmulation; // utility functions that the core requires us to implement extern const char* S9xGetFilename(const char* extension); extern const char* S9xGetDirectory(uint32_t dirtype); diff --git a/shell/input/sdl/input.c b/shell/input/sdl/input.c index 89034c0..158d7ef 100644 --- a/shell/input/sdl/input.c +++ b/shell/input/sdl/input.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "main.h" #include "snes9x.h" #include "soundux.h" @@ -67,7 +66,7 @@ uint32_t S9xReadJoypad(int32_t port) break; } break; - case SDLK_KEYUP: + case SDL_KEYUP: switch(event.key.keysym.sym) { case SDLK_HOME: diff --git a/shell/other/compatibility_layer.c b/shell/other/compatibility_layer.c index fea850b..27ffb5b 100644 --- a/shell/other/compatibility_layer.c +++ b/shell/other/compatibility_layer.c @@ -1,5 +1,4 @@ #include -#include #include "main.h" #include "snes9x.h" #include "soundux.h" diff --git a/source/apu.c b/source/apu.c index eb6fcb6..2413450 100644 --- a/source/apu.c +++ b/source/apu.c @@ -32,7 +32,7 @@ void S9xDeinitAPU() } } -uint8_t APUROM [64]; +extern uint8_t APUROM [64]; void S9xResetAPU() { diff --git a/source/apu.h b/source/apu.h index 42d266f..4a6d46f 100644 --- a/source/apu.h +++ b/source/apu.h @@ -46,8 +46,8 @@ typedef struct bool UNUSED2 [3]; } SAPU; -SAPU APU; -SIAPU IAPU; +extern SAPU APU; +extern SIAPU IAPU; static INLINE void S9xAPUUnpackStatus(void) { diff --git a/source/cpuops.c b/source/cpuops.c index 129ffef..99373d0 100644 --- a/source/cpuops.c +++ b/source/cpuops.c @@ -18,7 +18,7 @@ #include -int32_t OpAddress; +extern int32_t OpAddress; /* ADC */ static void Op69M1(void) diff --git a/source/soundux.h b/source/soundux.h index a3b4bbc..5cb4218 100644 --- a/source/soundux.h +++ b/source/soundux.h @@ -48,7 +48,7 @@ typedef struct bool mute_sound; } SoundStatus; -SoundStatus so; +extern SoundStatus so; typedef struct { @@ -105,7 +105,7 @@ typedef struct int32_t noise_hertz; } SSoundData; -SSoundData SoundData; +extern SSoundData SoundData; void S9xSetSoundVolume(int32_t channel, int16_t volume_left, int16_t volume_right); void S9xSetSoundFrequency(int32_t channel, int32_t hertz); -- cgit v1.2.3 From ae24fbb08e49a2b39887c83fc9c5974606453a35 Mon Sep 17 00:00:00 2001 From: m45t3r Date: Thu, 12 Nov 2020 00:20:16 -0300 Subject: Add Makefile.gcw0 --- Makefile.gcw0 | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Makefile.gcw0 diff --git a/Makefile.gcw0 b/Makefile.gcw0 new file mode 100644 index 0000000..d368aa5 --- /dev/null +++ b/Makefile.gcw0 @@ -0,0 +1,73 @@ +GIT_VERSION := "$(shell git describe --abbrev=7 --dirty --always)" + +PRGNAME = snes9x + +VIDEO_BACKEND = sdl +INPUT_BACKEND = sdl +SOUND_BACKEND = alsa + +PREFIX = mipsel-linux + +# define regarding OS, which compiler to use +CC = $(PREFIX)-gcc +STRIP = $(PREFIX)-strip +AS = $(PREFIX)-as +GASM = $(PREFIX)-g++ + +SYSROOT := $(shell $(CC) --print-sysroot) +SDL_CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags) +SDL_LIBS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs) + +# change compilation / linking flag options +CFLAGS = -DLSB_FIRST -I. -Ilibretro-common/include -Isrc -DINLINE="inline" -DRIGHTSHIFT_IS_SAR +CFLAGS += -Isource -I./shell/emu -I./shell/scalers -I./shell/emu -I./shell/audio -I./shell/menu -I./shell/video/sdl -I./shell/input -Ishell/headers + +CFLAGS += -Ofast -fsingle-precision-constant -fno-PIC -flto +ifndef PROFILE +CFLAGS += -falign-functions=1 -falign-jumps=1 -falign-loops=1 -falign-labels=1 +endif +CFLAGS += -DNDEBUG -DLAGFIX -DFRAMESKIP -DUSE_BLARGG_APU -DGIT_VERSION=\"$(GIT_VERSION)\" -fno-builtin -fno-exceptions -ffunction-sections -std=gnu99 +CFLAGS += -Wall -Wextra -pedantic -Wno-switch -Wno-implicit-function-declaration -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wno-uninitialized -Wno-strict-aliasing -Wno-overflow -fno-strict-overflow + +ifeq ($(PROFILE), YES) +CFLAGS += -fprofile-generate=./profile +else ifeq ($(PROFILE), APPLY) +CFLAGS += -fprofile-use -fprofile-dir=./profile -fbranch-probabilities +endif + +LDFLAGS = -lc -lgcc -lm $(SDL_LIBS) -no-pie -Wl,--as-needed -Wl,--gc-sections -s -flto +ifeq ($(SOUND_BACKEND), portaudio) +LDFLAGS += -lasound -lportaudio +endif +ifeq ($(SOUND_BACKEND), libao) +LDFLAGS += -lao +endif +ifeq ($(SOUND_BACKEND), alsa) +LDFLAGS += -lasound +endif +ifeq ($(SOUND_BACKEND), pulse) +LDFLAGS += -lpulse -lpulse-simple +endif + +ifeq ($(PROFILE), YES) +LDFLAGS += -lgcov +endif + +# Files to be compiled +SRCDIR = ./source ./shell/emu ./shell/scalers ./shell/audio/$(SOUND_BACKEND) ./shell/menu ./shell/video/$(VIDEO_BACKEND) ./shell/input/$(INPUT_BACKEND) ./shell/other +VPATH = $(SRCDIR) +SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c)) +SRC_CP = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.cpp)) +OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C))) +OBJ_CP = $(notdir $(patsubst %.cpp, %.o, $(SRC_CP))) +OBJS = $(OBJ_C) $(OBJ_CP) + +# Rules to make executable +$(PRGNAME): $(OBJS) + $(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS) + +$(OBJ_C) : %.o : %.c + $(CC) $(CFLAGS) -c -o $@ $< + +clean: + rm -f $(PRGNAME)$(EXESUFFIX) *.o -- cgit v1.2.3 From 6184d29f49d7bad5429c8e3e17ef61d36a3f3599 Mon Sep 17 00:00:00 2001 From: m45t3r Date: Thu, 12 Nov 2020 00:20:19 -0300 Subject: Add make_opk.sh --- opk/default.gcw0.desktop | 12 ++++++++++++ opk/make_opk.sh | 15 +++++++++++++++ opk/sfc.png | Bin 0 -> 3011 bytes 3 files changed, 27 insertions(+) create mode 100644 opk/default.gcw0.desktop create mode 100755 opk/make_opk.sh create mode 100644 opk/sfc.png diff --git a/opk/default.gcw0.desktop b/opk/default.gcw0.desktop new file mode 100644 index 0000000..cba0da9 --- /dev/null +++ b/opk/default.gcw0.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=snes9emu +Comment=Super Nintendo emulator +Comment[fr]=Émulateur de Super Nintendo +Comment[es]=Emulador de Super Nintendo +Exec=snes9x %f +Terminal=false +Type=Application +StartupNotify=true +Icon=sfc +Categories=emulators; +MimeType=application/x-snes-rom;application/zip; diff --git a/opk/make_opk.sh b/opk/make_opk.sh new file mode 100755 index 0000000..f263b63 --- /dev/null +++ b/opk/make_opk.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +cd $(dirname "$0") + +OPK_NAME="${1:-snesemu.opk}" + +echo Building "${OPK_NAME}"... + +# create opk +FLIST="../snes9x default.gcw0.desktop sfc.png" + +rm -f "${OPK_NAME}" +mksquashfs ${FLIST} "${OPK_NAME}" -all-root -no-xattrs -noappend -no-exports + +cat default.gcw0.desktop diff --git a/opk/sfc.png b/opk/sfc.png new file mode 100644 index 0000000..0fe6f7e Binary files /dev/null and b/opk/sfc.png differ -- cgit v1.2.3 From bd845b9085ab3f59a66278c4f7d4d00877d8fce1 Mon Sep 17 00:00:00 2001 From: m45t3r Date: Thu, 12 Nov 2020 00:22:38 -0300 Subject: Fix buttons --- shell/menu/menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/menu/menu.c b/shell/menu/menu.c index a8c24b5..af5e5e7 100644 --- a/shell/menu/menu.c +++ b/shell/menu/menu.c @@ -83,8 +83,8 @@ static void config_load() option.config_buttons[0][4] = SDLK_LCTRL; // A option.config_buttons[0][5] = SDLK_LALT; // B - option.config_buttons[0][6] = SDLK_LSHIFT; // X - option.config_buttons[0][7] = SDLK_SPACE; // Y + option.config_buttons[0][6] = SDLK_SPACE; // X + option.config_buttons[0][7] = SDLK_LSHIFT; // Y option.config_buttons[0][8] = SDLK_TAB; // L option.config_buttons[0][9] = SDLK_BACKSPACE; // R -- cgit v1.2.3