Skip to content

Commit

Permalink
Add support for changing refresh rates in docked mode (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
masagrator authored Dec 18, 2024
1 parent 4c02e88 commit 519979b
Show file tree
Hide file tree
Showing 10 changed files with 1,489 additions and 1,625 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Remember to restart Switch
---

# Thanks to
- `Cooler3D` for sharing code with me how he was changing display refresh rate in his tools that were first publicly available tools allowing this on HOS. I have used that as basis to make my own function.
- `Cooler3D` for sharing code with me how he was changing handheld display refresh rate in his tools that were first publicly available tools allowing this on HOS. I have used that as basis to make my own function.

# List of titles not compatible with plugins/patches

Expand Down
2 changes: 1 addition & 1 deletion libnx_min/nx/switch.specs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%rename link old_link

*link:
%(old_link) -T %:getenv(DEVKITPRO /libnx/switch.ld) -pie --gc-sections -z text -z nodynamic-undefined-weak --build-id=sha1 --nx-module-name
%(old_link) -T %:getenv(TOPDIR /../libnx_min/nx/switch.ld) -pie --gc-sections -z text -z nodynamic-undefined-weak --build-id=sha1 --nx-module-name

*startfile:
crti%O%s crtbegin%O%s
Expand Down
19 changes: 12 additions & 7 deletions saltysd_core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/de
endif

TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_rules
include $(TOPDIR)/../libnx_min/nx/switch_rules

#---------------------------------------------------------------------------------
# TARGET is the name of the output
Expand All @@ -31,15 +31,15 @@ include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
TARGET := saltysd_core
BUILD := build
SOURCES := source
SOURCES := source source/tinyexpr
DATA := data
INCLUDES := include
EXEFS_SRC := exefs_src

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -fno-plt
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE -fno-plt

CFLAGS := -Wall -O2 \
-ffast-math \
Expand All @@ -49,16 +49,18 @@ CFLAGS += $(INCLUDE) -DSWITCH

CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++23

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-s,--dynamic-list=$(CURDIR)/../dynamic_symbols.txt -Wl,-Map,$(notdir $*.map)
ASFLAGS := -g $(ARCH)

LDFLAGS = -specs=$(TOPDIR)/../libnx_min/nx/switch.specs -g $(ARCH) -Wl,-s,--dynamic-list=$(CURDIR)/../dynamic_symbols.txt -Wl,-Map,$(notdir $*.map)
LDFLAGS_TEST_DEBUG = -specs=$(TOPDIR)/../libnx_min/nx/switch.specs -g $(ARCH)

LIBS := -lnx_min

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX) $(CURDIR)/../libnx_min/nx/
LIBDIRS := $(PORTLIBS) $(CURDIR)/../libnx_min/nx/


#---------------------------------------------------------------------------------
Expand Down Expand Up @@ -98,6 +100,8 @@ endif
export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)

export OFILES2 := $(foreach file,$(OFILES),$(BUILD)/$(file))

export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
Expand Down Expand Up @@ -139,11 +143,12 @@ all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@$(LD) $(LDFLAGS_TEST_DEBUG) $(OFILES2) $(LIBPATHS) $(LIBS) -o $(TARGET)-debug.elf

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).pfs0 $(TARGET).nso $(TARGET).nro $(TARGET).nsp $(TARGET).nacp $(TARGET).elf
@rm -fr $(BUILD) $(TARGET).pfs0 $(TARGET).nso $(TARGET).nro $(TARGET).nsp $(TARGET).nacp $(TARGET).elf $(TARGET)-debug.elf


#---------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 519979b

Please sign in to comment.