aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgameblabla2020-11-13 11:51:03 +0000
committerGitHub2020-11-13 11:51:03 +0000
commit2c0f6b94dde7ee731b12d8cd0325125a4130f7e1 (patch)
tree561d15ab3b9d9b7019420b6d8a01c652a65e6433
parentc6d560b0adc5b321115f2597091422787588b807 (diff)
parentbd845b9085ab3f59a66278c4f7d4d00877d8fce1 (diff)
downloadsnesemu-2c0f6b94dde7ee731b12d8cd0325125a4130f7e1.tar.gz
snesemu-2c0f6b94dde7ee731b12d8cd0325125a4130f7e1.tar.bz2
snesemu-2c0f6b94dde7ee731b12d8cd0325125a4130f7e1.zip
Merge pull request #2 from m45t3r/gcw0-support
GCW0 support and some fixes
-rw-r--r--Makefile.gcw073
-rw-r--r--opk/default.gcw0.desktop12
-rwxr-xr-xopk/make_opk.sh15
-rw-r--r--opk/sfc.pngbin0 -> 3011 bytes
-rw-r--r--shell/emu/main.h1
-rw-r--r--shell/input/sdl/input.c3
-rw-r--r--shell/menu/menu.c4
-rw-r--r--shell/other/compatibility_layer.c1
-rw-r--r--source/apu.c2
-rw-r--r--source/apu.h4
-rw-r--r--source/cpuops.c2
-rw-r--r--source/soundux.h4
12 files changed, 109 insertions, 12 deletions
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
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
--- /dev/null
+++ b/opk/sfc.png
Binary files differ
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 <SDL/SDL.h>
#include <stdint.h>
#include <stdio.h>
-#include <portaudio.h>
#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/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
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 <SDL/SDL.h>
-#include <portaudio.h>
#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 <retro_inline.h>
-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);