Skip to content

Commit

Permalink
Enhancement: Speed boost (n64decomp#70)
Browse files Browse the repository at this point in the history
* Initial commit

* Remove personal bin path

* Add missing lib files

* No need for old GFX select buttons

* APT_SetAppCpuTimeLimit to %70 not 80% its actually faster

* Remove custom libctru for easier merging

* Reenable GFX buttons

* Code Cleanup

* More cleanup

* Remove one last comment
  • Loading branch information
RetroGamer02 authored Nov 5, 2022
1 parent 7b56b78 commit 0e5071e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ ifeq ($(TARGET_N3DS),1)
CTRULIB := $(DEVKITPRO)/libctru
LIBDIRS := $(CTRULIB)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
PLATFORM_CFLAGS := -mtp=soft -DTARGET_N3DS -DARM11 -DosGetTime=n64_osGetTime -D_3DS -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations -fomit-frame-pointer -ffast-math $(foreach dir,$(LIBDIRS),-I$(dir)/include)
PLATFORM_CFLAGS := -mtp=soft -DTARGET_N3DS -DARM11 -DosGetTime=n64_osGetTime -D_3DS -D__3DS__ -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations -fomit-frame-pointer -ffast-math $(foreach dir,$(LIBDIRS),-I$(dir)/include)
PLATFORM_LDFLAGS := $(LIBPATHS) -lcitro3d -lctru -lm -specs=3dsx.specs -g -marm -mthumb-interwork -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
ifeq ($(DISABLE_AUDIO),1)
PLATFORM_CFLAGS += -DDISABLE_AUDIO
Expand Down Expand Up @@ -545,7 +545,7 @@ else
endif

CC_CHECK := $(CC) -fsyntax-only -fsigned-char $(INCLUDE_CFLAGS) -Wall -Wextra -Wno-format-security -D_LANGUAGE_C $(VERSION_CFLAGS) $(MATCH_CFLAGS) $(PLATFORM_CFLAGS) $(GFX_CFLAGS) $(GRUCODE_CFLAGS)
CFLAGS := $(OPT_FLAGS) $(INCLUDE_CFLAGS) -D_LANGUAGE_C $(VERSION_CFLAGS) $(MATCH_CFLAGS) $(PLATFORM_CFLAGS) $(GFX_CFLAGS) $(GRUCODE_CFLAGS) $(MARCH_FLAGS) -fno-strict-aliasing -fwrapv
CFLAGS := -O3 $(INCLUDE_CFLAGS) -D_LANGUAGE_C $(VERSION_CFLAGS) $(MATCH_CFLAGS) $(PLATFORM_CFLAGS) $(GFX_CFLAGS) $(GRUCODE_CFLAGS) $(MARCH_FLAGS) -fno-strict-aliasing -fwrapv

ASFLAGS := -I include -I $(BUILD_DIR) $(VERSION_ASFLAGS)

Expand Down
4 changes: 2 additions & 2 deletions enhancements/60fps.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ index 619f84d..fa11f9a 100644
CTRULIB := $(DEVKITPRO)/libctru
LIBDIRS := $(CTRULIB)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
- PLATFORM_CFLAGS := -mtp=soft -DTARGET_N3DS -DARM11 -DosGetTime=n64_osGetTime -D_3DS -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations -fomit-frame-pointer -ffast-math $(foreach dir,$(LIBDIRS),-I$(dir)/include)
+ PLATFORM_CFLAGS := -mtp=soft -DTARGET_N3DS -D_60FPS_PATCH -DARM11 -DosGetTime=n64_osGetTime -D_3DS -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations -fomit-frame-pointer -ffast-math $(foreach dir,$(LIBDIRS),-I$(dir)/include)
- PLATFORM_CFLAGS := -mtp=soft -DTARGET_N3DS -DARM11 -DosGetTime=n64_osGetTime -D_3DS -D__3DS__ -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations -fomit-frame-pointer -ffast-math $(foreach dir,$(LIBDIRS),-I$(dir)/include)
+ PLATFORM_CFLAGS := -mtp=soft -DTARGET_N3DS -D_60FPS_PATCH -DARM11 -DosGetTime=n64_osGetTime -D_3DS -D__3DS__ -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations -fomit-frame-pointer -ffast-math $(foreach dir,$(LIBDIRS),-I$(dir)/include)
PLATFORM_LDFLAGS := $(LIBPATHS) -lcitro3d -lctru -lm -specs=3dsx.specs -g -marm -mthumb-interwork -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
ifeq ($(DISABLE_AUDIO),1)
PLATFORM_CFLAGS += -DDISABLE_AUDIO
Expand Down
14 changes: 11 additions & 3 deletions src/pc/audio/audio_3ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,25 @@ static bool audio_3ds_init()
LightEvent_Init(&s_event_main, RESET_ONESHOT);

s32 prio = 0;
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);

int cpu;
if (is_new_n3ds())
{
cpu = 2; // n3ds 3rd core
else if (R_SUCCEEDED(APT_SetAppCpuTimeLimit(80)))
prio = 0x18;
}
else if (R_SUCCEEDED(APT_SetAppCpuTimeLimit(70)))
{
cpu = 1; // o3ds 2nd core (system)
prio = 0x18;
}
else
{
cpu = 0; // better to have choppy sound than no sound?
prio = 0x19;
}

threadId = threadCreate(audio_3ds_loop, 0, 128 * 1024, prio - 1, cpu, true);
threadId = threadCreate(audio_3ds_loop, 0, 64 * 1024, prio, cpu, true);

if (threadId)
printf("Created audio thread on core %i\n", cpu);
Expand Down
2 changes: 1 addition & 1 deletion tools/audiofile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ libaudiofile.a: audiofile.o
ar rcs libaudiofile.a audiofile.o

audiofile.o: audiofile.cpp audiofile.h aupvlist.h
$(CXX) -std=c++11 -O2 -I. -c audiofile.cpp
$(CXX) -std=gnu++11 -O3 -ffast-math -I. -c audiofile.cpp

clean:
rm -f audiofile.o libaudiofile.a
Expand Down
2 changes: 1 addition & 1 deletion tools/audiofile/audiofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10184,7 +10184,7 @@ static const TrackSetup _af_default_tracksetup =
{
0,
{
44100.0,
32728.5,
AF_SAMPFMT_TWOSCOMP,
16,
_AF_BYTEORDER_NATIVE,
Expand Down
2 changes: 1 addition & 1 deletion tools/sdk-tools/tabledesign/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ IRIX_CC := $(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc
IRIX_CFLAGS := -fullwarn -Wab,-r4300_mul -Xcpluscomm -mips1 -O2

NATIVE_CC := gcc
NATIVE_CFLAGS := -Wall -Wno-uninitialized -O2
NATIVE_CFLAGS := -Wall -Wno-uninitialized -O3

LDFLAGS := -lm -laudiofile

Expand Down

0 comments on commit 0e5071e

Please sign in to comment.