mirror of
https://github.com/libretro/smsplus-gx.git
synced 2024-11-23 09:09:51 +00:00
Delete RS-97 port (no longer needed), fix GCW0 port and make minor
changes to audio code. We are now linking against the newer toolchain with support for Huge pages.
This commit is contained in:
parent
978028f5db
commit
be19161bfb
76
Makefile.350h
Normal file
76
Makefile.350h
Normal file
@ -0,0 +1,76 @@
|
||||
PRGNAME = sms_sdl
|
||||
CC = /opt/gcw0-toolchain-static/usr/bin/mipsel-linux-gcc
|
||||
|
||||
# Possible choices : rs97, k3s (PAP K3S), sdl, amini, fbdev
|
||||
PORT = 350h
|
||||
# Possible choices : alsa, pulse (pulseaudio), oss, sdl12 (SDL 1.2 sound output), portaudio, libao
|
||||
SOUND_OUTPUT = alsa
|
||||
# Possible choices : crabemu_sn76489 (less accurate, GPLv2), maxim_sn76489 (somewhat problematic license but good accuracy)
|
||||
SOUND_ENGINE = maxim_sn76489
|
||||
# Possible choices : z80 (accurate), eighty (EightyZ80's core, GPLv2)
|
||||
Z80_CORE = z80
|
||||
SCALE2X_UPSCALER = 1
|
||||
PROFILE = 0
|
||||
ZIP_SUPPORT = 1
|
||||
|
||||
SRCDIR = ./source ./source/cpu_cores/$(Z80_CORE) ./source/sound ./source/unzip
|
||||
SRCDIR += ./source/scalers ./source/ports/$(PORT) ./source/sound/$(SOUND_ENGINE) ./source/sound_output/$(SOUND_OUTPUT)
|
||||
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)
|
||||
|
||||
CFLAGS = -Ofast -fdata-sections -ffunction-sections -mframe-header-opt -mno-fp-exceptions -mno-check-zero-division -fsingle-precision-constant -fno-common -march=mips32r2 -mtune=mips32r2 -mno-abicalls -fno-PIC -flto
|
||||
# SMS Plus GX suffers from alignment issues so setting these to 1 helps.
|
||||
CFLAGS += -falign-functions=1 -falign-jumps=1 -falign-loops=1 -falign-labels=1
|
||||
CFLAGS += -fipa-pta -fsection-anchors -fdelete-dead-exceptions
|
||||
CFLAGS += -DALIGN_DWORD -DNOBLANKING_LEFTCOLUM
|
||||
CFLAGS += -DLSB_FIRST -std=gnu99
|
||||
CFLAGS += -Isource -Isource/cpu_cores/$(Z80_CORE) -Isource/scalers -Isource/ports/$(PORT) -I./source/sound -Isource/unzip -Isource/sdl -Isource/sound/$(SOUND_ENGINE) -Isource/sound_output
|
||||
|
||||
SRCDIR += ./source/text/fb
|
||||
CFLAGS += -Isource/text/fb
|
||||
|
||||
ifeq ($(PROFILE), YES)
|
||||
CFLAGS += -fprofile-generate=/usr/local/home/.smsplus
|
||||
else ifeq ($(PROFILE), APPLY)
|
||||
CFLAGS += -fprofile-use -fbranch-probabilities
|
||||
endif
|
||||
|
||||
ifeq ($(SOUND_ENGINE), maxim_sn76489)
|
||||
CFLAGS += -DMAXIM_PSG
|
||||
endif
|
||||
|
||||
ifeq ($(ZIP_SUPPORT), 0)
|
||||
CFLAGS += -DNOZIP_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(SCALE2X_UPSCALER), 1)
|
||||
CFLAGS += -DSCALE2X_UPSCALER
|
||||
CFLAGS += -Isource/scale2x
|
||||
SRCDIR += ./source/scale2x
|
||||
endif
|
||||
|
||||
LDFLAGS = -nodefaultlibs -lc -lgcc -lSDL -lasound -lm -Wl,--as-needed -Wl,--gc-sections -flto -s
|
||||
|
||||
ifeq ($(SOUND_OUTPUT), portaudio)
|
||||
LDFLAGS += -lportaudio
|
||||
endif
|
||||
ifeq ($(SOUND_OUTPUT), libao)
|
||||
LDFLAGS += -lao
|
||||
endif
|
||||
ifeq ($(SOUND_OUTPUT), alsa)
|
||||
LDFLAGS += -lasound
|
||||
endif
|
||||
|
||||
# Rules to make executable
|
||||
$(PRGNAME): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
|
||||
|
||||
$(OBJ_C) : %.o : %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(PRGNAME) *.o
|
@ -10,8 +10,9 @@ SOUND_ENGINE = maxim_sn76489
|
||||
# Possible choices : z80 (accurate), eighty (EightyZ80's core, GPLv2)
|
||||
Z80_CORE = z80
|
||||
SCALE2X_UPSCALER = 1
|
||||
PROFILE = 0
|
||||
PROFILE = APPLY
|
||||
ZIP_SUPPORT = 1
|
||||
HUGE_PAGES = 1
|
||||
|
||||
SRCDIR = ./source ./source/cpu_cores/$(Z80_CORE) ./source/sound ./source/unzip
|
||||
SRCDIR += ./source/scalers ./source/ports/$(PORT) ./source/sound/$(SOUND_ENGINE) ./source/sound_output/$(SOUND_OUTPUT)
|
||||
@ -22,11 +23,11 @@ OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
|
||||
OBJ_CP = $(notdir $(patsubst %.cpp, %.o, $(SRC_CP)))
|
||||
OBJS = $(OBJ_C) $(OBJ_CP)
|
||||
|
||||
CFLAGS = -Ofast -fdata-sections -ffunction-sections -mno-fp-exceptions -mno-check-zero-division -fsingle-precision-constant -fno-common -mips32 -fno-PIC -mno-abicalls -flto
|
||||
CFLAGS = -Ofast -fdata-sections -ffunction-sections -mframe-header-opt -mno-fp-exceptions -mno-check-zero-division -fsingle-precision-constant -fno-common -march=mips32r2 -mtune=mips32r2 -flto
|
||||
# SMS Plus GX suffers from alignment issues so setting these to 1 helps.
|
||||
CFLAGS += -falign-functions=1 -falign-jumps=1 -falign-loops=1 -falign-labels=1
|
||||
CFLAGS += -fipa-pta -fsection-anchors -fdelete-dead-exceptions
|
||||
CFLAGS += -DALIGN_DWORD -DNOBLANKING_LEFTCOLUM
|
||||
CFLAGS += -DALIGN_DWORD -DNOBLANKING_LEFTCOLUM -DOPENDINGUX_GCD_16PIXELS_ISSUE
|
||||
CFLAGS += -DLSB_FIRST -std=gnu99
|
||||
CFLAGS += -Isource -Isource/cpu_cores/$(Z80_CORE) -Isource/scalers -Isource/ports/$(PORT) -I./source/sound -Isource/unzip -Isource/sdl -Isource/sound/$(SOUND_ENGINE) -Isource/sound_output
|
||||
|
||||
@ -53,7 +54,13 @@ CFLAGS += -Isource/scale2x
|
||||
SRCDIR += ./source/scale2x
|
||||
endif
|
||||
|
||||
LDFLAGS = -nodefaultlibs -lc -lgcc -lSDL -lm -Wl,--as-needed -Wl,--gc-sections -flto
|
||||
ifeq ($(HUGE_PAGES), 0)
|
||||
LDFLAGS = -nodefaultlibs
|
||||
endif
|
||||
LDFLAGS += -lc -lgcc -lSDL -lasound -lm -flto -s
|
||||
ifeq ($(HUGE_PAGES), 1)
|
||||
LDFLAGS += -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs
|
||||
endif
|
||||
|
||||
ifeq ($(SOUND_OUTPUT), portaudio)
|
||||
LDFLAGS += -lportaudio
|
||||
@ -71,6 +78,9 @@ endif
|
||||
# Rules to make executable
|
||||
$(PRGNAME): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $(PRGNAME) $^ $(LDFLAGS)
|
||||
ifeq ($(HUGE_PAGES), 1)
|
||||
hugeedit --text --data $(PRGNAME)
|
||||
endif
|
||||
|
||||
$(OBJ_C) : %.o : %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
@ -2,7 +2,7 @@ PRGNAME = sms_sdl
|
||||
CC = /opt/rs97-toolchain/bin/mipsel-linux-gcc
|
||||
STRIP = /opt/rs97-toolchain/bin/mipsel-linux-strip
|
||||
# Possible choices : rs97, k3s (PAP K3S), sdl, amini, fbdev
|
||||
PORT = rs97
|
||||
PORT = gcw0
|
||||
# Possible choices : alsa, pulse (pulseaudio), oss, sdl12 (SDL 1.2 sound output), portaudio, libao
|
||||
SOUND_OUTPUT = oss
|
||||
# Possible choices : crabemu_sn76489 (less accurate, GPLv2), maxim_sn76489 (somewhat problematic license but good accuracy)
|
||||
@ -10,7 +10,7 @@ SOUND_ENGINE = maxim_sn76489
|
||||
# Possible choices : z80 (accurate but proprietary), eighty (EightyZ80's core, GPLv2)
|
||||
Z80_CORE = z80
|
||||
SCALE2X_UPSCALER = 1
|
||||
PROFILE = APPLY
|
||||
PROFILE = YES
|
||||
ZIP_SUPPORT = 1
|
||||
|
||||
SRCDIR = ./source ./source/cpu_cores/$(Z80_CORE) ./source/sound ./source/unzip
|
||||
@ -22,8 +22,8 @@ OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
|
||||
OBJ_CP = $(notdir $(patsubst %.cpp, %.o, $(SRC_CP)))
|
||||
OBJS = $(OBJ_C) $(OBJ_CP)
|
||||
|
||||
CFLAGS = -Ofast -fdata-sections -ffunction-sections -mno-fp-exceptions -mno-check-zero-division -mframe-header-opt -fsingle-precision-constant -fno-common -mxgot -mips32 -mno-mips16 -fno-PIC -mno-abicalls -flto -fwhole-program
|
||||
CFLAGS += -DALIGN_DWORD
|
||||
CFLAGS = -Ofast -fdata-sections -ffunction-sections -mno-fp-exceptions -mno-check-zero-division -mframe-header-opt -fsingle-precision-constant -fno-common -mxgot -mips32 -mno-mips16 -fno-PIC -mno-abicalls -flto
|
||||
CFLAGS += -DALIGN_DWORD -DRS97 -Wall -Wextra
|
||||
CFLAGS += -DLSB_FIRST -std=gnu99
|
||||
CFLAGS += -Isource -Isource/cpu_cores/$(Z80_CORE) -Isource/scalers -Isource/ports/$(PORT) -I./source/sound -Isource/unzip -Isource/sdl -Isource/sound/$(SOUND_ENGINE) -Isource/sound_output
|
||||
|
||||
|
@ -14,9 +14,8 @@
|
||||
#include "font_drawing.h"
|
||||
#include "sound_output.h"
|
||||
|
||||
#if !SDL_TRIPLEBUF
|
||||
#define SDL_TRIPLEBUF SDL_DOUBLEBUF
|
||||
#endif
|
||||
|
||||
#define SDL_FLAGS SDL_HWSURFACE
|
||||
|
||||
static SDL_Joystick * sdl_joy[3];
|
||||
#define joy_commit_range 8192
|
||||
@ -133,7 +132,17 @@ static void video_update()
|
||||
dst.h = vdp.height;
|
||||
}
|
||||
dst.y = 0;
|
||||
SDL_BlitSurface(sms_bitmap,&dst,sdl_screen,NULL);
|
||||
#ifdef OPENDINGUX_GCD_16PIXELS_ISSUE
|
||||
dst2.x = width_remove ? 4 : 0;
|
||||
dst2.y = 0;
|
||||
#endif
|
||||
SDL_BlitSurface(sms_bitmap,&dst,sdl_screen,
|
||||
#ifdef OPENDINGUX_GCD_16PIXELS_ISSUE
|
||||
&dst2
|
||||
#else
|
||||
NULL
|
||||
#endif
|
||||
);
|
||||
break;
|
||||
// Hqx
|
||||
case 3:
|
||||
@ -999,22 +1008,26 @@ static void Cleanup(void)
|
||||
system_shutdown();
|
||||
}
|
||||
|
||||
#define SDL_FLAGS SDL_HWSURFACE
|
||||
|
||||
uint32_t update_window_size(uint32_t w, uint32_t h)
|
||||
{
|
||||
if (sdl_screen) SDL_FreeSurface(sdl_screen);
|
||||
|
||||
if (option.fullscreen == 0)
|
||||
{
|
||||
sdl_screen = SDL_SetVideoMode(HOST_WIDTH_RESOLUTION, HOST_HEIGHT_RESOLUTION, 16, SDL_FLAGS);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef OPENDINGUX_GCD_16PIXELS_ISSUE
|
||||
if (w == 248 && h == 192) w = 256;
|
||||
#endif
|
||||
sdl_screen = SDL_SetVideoMode(w, h, 16, SDL_FLAGS);
|
||||
}
|
||||
|
||||
if (!sdl_screen)
|
||||
{
|
||||
printf("SDL_SetVideoMode error\n");
|
||||
fprintf(stderr,"SDL_SetVideoMode Initialisation error : %s",SDL_GetError());
|
||||
printf("Width %d, Height %d, FLAGS 0x%x\n", w, h, SDL_FLAGS);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
#ifndef SMSPLUS_H
|
||||
#define SMSPLUS_H
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#define HOST_WIDTH_RESOLUTION 320
|
||||
#define HOST_HEIGHT_RESOLUTION 240
|
||||
|
||||
#define VIDEO_WIDTH_SMS 256
|
||||
#define VIDEO_HEIGHT_SMS 192
|
||||
#define VIDEO_WIDTH_GG 160
|
||||
#define VIDEO_HEIGHT_GG 144
|
||||
|
||||
/* Input defines for custom remapping */
|
||||
#define CONFIG_BUTTON_UP 0
|
||||
#define CONFIG_BUTTON_DOWN 1
|
||||
#define CONFIG_BUTTON_LEFT 2
|
||||
#define CONFIG_BUTTON_RIGHT 3
|
||||
#define CONFIG_BUTTON_BUTTON1 4
|
||||
#define CONFIG_BUTTON_BUTTON2 5
|
||||
#define CONFIG_BUTTON_START 6
|
||||
|
||||
/* Colecovision specific */
|
||||
#define CONFIG_BUTTON_DOLLARS 7
|
||||
#define CONFIG_BUTTON_ASTERISK 8
|
||||
#define CONFIG_BUTTON_ONE 9
|
||||
#define CONFIG_BUTTON_TWO 10
|
||||
#define CONFIG_BUTTON_THREE 11
|
||||
#define CONFIG_BUTTON_FOUR 12
|
||||
#define CONFIG_BUTTON_FIVE 13
|
||||
#define CONFIG_BUTTON_SIX 14
|
||||
#define CONFIG_BUTTON_SEVEN 15
|
||||
#define CONFIG_BUTTON_EIGHT 16
|
||||
#define CONFIG_BUTTON_NINE 17
|
||||
|
||||
/* End of Defines for input remapping */
|
||||
|
||||
extern SDL_Surface* sms_bitmap;
|
||||
|
||||
#define LOCK_VIDEO SDL_LockSurface(sms_bitmap);
|
||||
#define UNLOCK_VIDEO SDL_UnlockSurface(sms_bitmap);
|
||||
|
||||
typedef struct {
|
||||
char gamename[256];
|
||||
char sramdir[256];
|
||||
char sramfile[256];
|
||||
char stdir[256];
|
||||
char scrdir[256];
|
||||
char biosdir[256];
|
||||
} gamedata_t;
|
||||
|
||||
void smsp_state(uint8_t slot_number, uint8_t mode);
|
||||
|
||||
#define SOUND_FREQUENCY 44100
|
||||
#define SOUND_SAMPLES_SIZE 1024
|
||||
|
||||
#endif
|
@ -132,7 +132,7 @@ void Sound_Update(void)
|
||||
|
||||
if (!handle) return;
|
||||
|
||||
for (i = 0; i < (len); i++)
|
||||
for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++)
|
||||
{
|
||||
buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel;
|
||||
buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel;
|
||||
|
@ -37,13 +37,14 @@ void Sound_Init()
|
||||
|
||||
void Sound_Update()
|
||||
{
|
||||
int32_t i;
|
||||
for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++)
|
||||
size_t i;
|
||||
size_t len = (SOUND_FREQUENCY / snd.fps);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel;
|
||||
buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel;
|
||||
}
|
||||
if (pa_simple_write(pulse_stream, buffer_snd, (size_t) (SOUND_FREQUENCY / snd.fps), NULL) < 0)
|
||||
if (pa_simple_write(pulse_stream, buffer_snd, len * 4, NULL) < 0)
|
||||
{
|
||||
fprintf(stderr, "PulseAudio: pa_simple_write() failed!\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user