Skip to content

Commit

Permalink
Polish 3ds port a bit
Browse files Browse the repository at this point in the history
- XMP music
- proper zlib as portlib
- full screen
- no more disabled joysticks
  • Loading branch information
carstene1ns committed Oct 23, 2017
1 parent 507775a commit ed47f5e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ EBOOT.PBP
# 3ds
*.3dsx
*.smdh
*.d
/build/

.DS_Store

Expand Down
9 changes: 6 additions & 3 deletions Makefile.3ds
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ SOURCES := src src/game src/io src/io/gfx src/jj1bonuslevel \
DATA := data
INCLUDES := src
#ROMFS := romfs
APP_TITLE := OpenJazz
#APP_DESCRIPTION:=
APP_AUTHOR := AlisterT & carstene1ns

#---------------------------------------------------------------------------------
# options for code generation
Expand All @@ -47,20 +50,20 @@ CFLAGS := -g -Wall -O2 -mword-relocations \
-fomit-frame-pointer -ffunction-sections \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM11 -D_3DS -DDATAPATH=\"sdmc:/3ds/OJ/\"
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -DUSE_XMP -DDATAPATH=\"sdmc:/3ds/OJ/\"

CXXFLAGS := $(CFLAGS) -frtti -fexceptions -std=gnu++11

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

LIBS := -lSDL -lcitro3d -lctru -lm
LIBS := -lSDL -lxmp -lcitro3d -lctru -lz -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CTRULIB) $(CURDIR)/SDL
LIBDIRS := $(CTRULIB) $(CURDIR)/deps


#---------------------------------------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions src/io/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,7 @@
#include "util.h"

#include <string.h>

#ifdef _3DS
#define MINIZ_HEADER_FILE_ONLY
#include "miniz.c"
#else
#include <zlib.h>
#endif

#ifndef _WIN32
#define UPPERCASE_FILENAMES
Expand Down
2 changes: 1 addition & 1 deletion src/io/gfx/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

#define FULLSCREEN_FLAGS (SDL_FULLSCREEN | SDL_SWSURFACE | SDL_HWPALETTE)
#elif defined(_3DS)
#define DEFAULT_SCREEN_WIDTH 320
#define DEFAULT_SCREEN_WIDTH 400
#define DEFAULT_SCREEN_HEIGHT 240

#define FULLSCREEN_ONLY
Expand Down
10 changes: 8 additions & 2 deletions src/io/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#endif


#ifdef __SYMBIAN32__
#if defined(__SYMBIAN32__) || defined(_3DS)
#define SOUND_FREQ 22050
#else
#define SOUND_FREQ 44100
Expand All @@ -68,8 +68,12 @@ ModPlugFile *musicFile;

#elif defined(USE_XMP)

# ifdef _3DS
#define MUSIC_INTERPOLATION XMP_INTERP_NEAREST
# else
#define MUSIC_INTERPOLATION XMP_INTERP_SPLINE
#define MUSIC_EFFECTS XMP_DSP_ALL
# endif

xmp_context xmpC;

Expand Down Expand Up @@ -163,7 +167,7 @@ void openAudio () {
asDesired.freq = SOUND_FREQ;
asDesired.format = AUDIO_S16;
asDesired.channels = 2;
#if defined(GP2X) || defined(PSP)
#if defined(GP2X) || defined(PSP) || defined(_3DS)
asDesired.samples = 512;
#else
asDesired.samples = 2048;
Expand Down Expand Up @@ -307,7 +311,9 @@ void playMusic (const char * fileName) {

xmp_start_player(xmpC, audioSpec.freq, playerFlags);
xmp_set_player(xmpC, XMP_PLAYER_INTERP, MUSIC_INTERPOLATION);
# ifdef MUSIC_EFFECTS
xmp_set_player(xmpC, XMP_PLAYER_DSP, MUSIC_EFFECTS);
# endif

#endif

Expand Down
7 changes: 1 addition & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,9 @@ int main(int argc, char *argv[]) {
atexit(sceKernelExitGame);
sceIoChdir("ms0:/PSP/GAME/OpenJazz");
#endif
//gfxInit(GSP_RGBA8_OES, GSP_BGR8_OES, false);
//consoleInit(GFX_BOTTOM, NULL);
//printf("\n\nOJ 3DS\n\n");

// Initialise SDL

// SDL_INIT_JOYSTICK crashes the 3ds
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) < 0) {
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK) < 0) {

logError("Could not start SDL", SDL_GetError());

Expand Down

0 comments on commit ed47f5e

Please sign in to comment.