Skip to content

Commit

Permalink
Fix 3DS simulator (UpsilonNumworks#243)
Browse files Browse the repository at this point in the history
* [CI] Fix 3DS try 1

* [CI] Fix 3DS try 2

* [CI] Fix 3DS try 3

* [CI] Fix 3DS try 4

* [CI] Fix 3DS try 5

* [CI] Fix 3DS try 6

* [CI] Fix 3DS try 7

* [CI] Fix 3DS try 8

* [CI] Fix 3DS try 9

* [CI] Fix 3DS try 10

* [CI] Fix 3DS try 11

* [CI] Fix 3DS try 12

* [CI] Fix 3DS try 13

* [CI] Fix 3DS try 14

* [CI] Fix 3DS try 15

* [CI] Fix 3DS try 16

* [CI] Fix 3DS try 17

* [CI] Fix 3DS try 18

* [CI] Fix 3DS try 19

* [CI] Make other simulators than 3DS working

* [CI] Fix 3DS without breaking others simulators try 1

* Apply suggestions from code review

* Improve SDL assert

* Fix SDL assert

* Fix SDL assert 2

* [CI] Enable iOS, macOS and 3DS tests by default

* [CI] Change epsilon-sdk tap url

* Revert "[CI] Change epsilon-sdk tap url"

This reverts commit 9516607.
  • Loading branch information
Yaya-Cout authored Apr 13, 2023
1 parent 0916996 commit aadcd37
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 19 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,32 @@ on:
triggerIos:
description: 'Run iOS tests'
required: true
default: 'no'
default: 'yes'
triggerMacos:
description: 'Run macOS tests'
required: true
default: 'no'
default: 'yes'
trigger3DS:
description: 'Run 3DS tests'
required: true
default: 'no'
default: 'yes'
jobs:
nintendo_3ds:
if: github.event.inputs.trigger3DS == 'yes'
if: github.event.inputs.trigger3DS == 'yes' || github.event.inputs.trigger3DS == ''
runs-on: ubuntu-latest
container: devkitpro/devkitarm:latest
steps:
- run: wget https://github.com/devkitPro/pacman/releases/download/v1.0.2/devkitpro-pacman.amd64.deb -O /tmp/devkitpro-pacman.deb
- run: yes | sudo dpkg -i /tmp/devkitpro-pacman.deb
- run: yes | sudo dkp-pacman -Syu --needed devkitARM 3dstools libctru
- run: echo ::set-env name=DEVKITPRO::/opt/devkitpro
- run: echo ::set-env name=DEVKITARM::/opt/devkitpro/devkitARM
- run: echo ::set-env name=PATH::$DEVKITPRO/tools/bin:$DEVKITARM/bin:$PATH

- uses: actions/checkout@v1
with:
submodules: true
- run: sudo apt-get update
- run: sudo apt-get install build-essential imagemagick libfreetype6-dev libjpeg-dev libpng-dev pkg-config -y
- run: yes | sudo dkp-pacman -S --needed devkitARM 3dstools libctru
- run: wget https://github.com/3DSGuy/Project_CTR/releases/download/makerom-v0.18.3/makerom-v0.18.3-ubuntu_x86_64.zip
- run: unzip makerom-v0.18.3-ubuntu_x86_64.zip
- run: rm makerom-v0.18.3-ubuntu_x86_64.zip
- run: chmod +x ./makerom
- run: echo "PATH=.:$PATH" >> $GITHUB_ENV
- run: make -j2 PLATFORM=simulator TARGET=3ds
- run: make -j2 PLATFORM=simulator TARGET=3ds epsilon.cia
- uses: actions/upload-artifact@master
Expand Down Expand Up @@ -278,7 +280,7 @@ jobs:
name: epsilon-linux.bin
path: output/release/simulator/linux/epsilon.bin
macos:
if: github.event.inputs.triggerMacos == 'yes'
if: github.event.inputs.triggerMacos == 'yes' || github.event.inputs.triggerMacos == ''
runs-on: macOS-latest
steps:
- run: brew install numworks/tap/epsilon-sdk
Expand All @@ -293,7 +295,7 @@ jobs:
name: epsilon-macos.zip
path: output/release/simulator/macos/epsilon.app
ios:
if: github.event.inputs.triggerIos == 'yes'
if: github.event.inputs.triggerIos == 'yes' || github.event.inputs.triggerIos == ''
runs-on: macOS-latest
steps:
- run: brew install numworks/tap/epsilon-sdk
Expand Down
2 changes: 2 additions & 0 deletions build/platform.simulator.3ds.mak
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
TOOLCHAIN = devkitarm
EXE = elf

EPSILON_TELEMETRY ?= 0

HANDY_TARGETS_EXTENSIONS = 3dsx cia

2 changes: 1 addition & 1 deletion build/targets.simulator.3ds.mak
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

%.smdh: ion/src/simulator/3ds/assets/logo.png
$(Q) echo "SMDH $(notdir $@)"
$(Q) smdhtool --create "Epsilon" "A Numworks in your 3DS!" "Numworks" $< $@
$(Q) smdhtool --create "Upsilon" "A Numworks in your 3DS!" "Numworks" $< $@

$(BUILD_DIR)/%.3dsx: $(BUILD_DIR)/%.elf $(BUILD_DIR)/%.smdh
$(Q) echo "3DSX $(notdir $@)"
Expand Down
2 changes: 1 addition & 1 deletion build/toolchain.devkitarm.mak
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ LIBDIRS := $(DEVKITPRO)/libctru
INCLUDE = $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)

CFLAGS += $(INCLUDE) -DARM11 -D_3DS
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -D__3DS__

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

Expand Down
13 changes: 10 additions & 3 deletions ion/src/simulator/3ds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,29 @@ ion_src += $(addprefix ion/src/simulator/3ds/, \

ion_src += ion/src/shared/collect_registers.cpp

sdl_simu_needs_to_be_removed += $(addprefix ion/src/simulator/shared/, \
sdl_simu_needs_to_be_removed += $(addprefix ion/src/shared/, \
dummy/display.cpp \
dummy/led.cpp \
dummy/usb.cpp \
dummy/battery.cpp \
dummy/store_script.cpp \
)

sdl_simu_needs_to_be_removed += $(addprefix ion/src/simulator/shared/, \
clipboard.cpp \
display.cpp:-headless \
events_keyboard.cpp:-headless \
events.cpp \
events_platform.cpp \
framebuffer_base.cpp \
framebuffer.cpp \
keyboard_sdl.cpp:-headless \
keyboard.cpp \
main_sdl.cpp:-headless \
main.cpp \
layout.cpp:-headless \
dummy/store_script.cpp \
timing.cpp \
)

# Remove the dummy display (re-implemented) and the SDL simulator stuff.
ion_src := $(filter-out $(sdl_simu_needs_to_be_removed),$(ion_src))

4 changes: 4 additions & 0 deletions ion/src/simulator/3ds/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ void Ion::Timing::msleep(uint32_t ms) {
svcSleepThread((s64) ms * 1000);
}

uint64_t Ion::Timing::millis() {
return svcGetSystemTick() / (1000 * 1000);
}

int main(int argc, char * argv[]) {
Ion::Simulator::Main::init();

Expand Down
7 changes: 6 additions & 1 deletion ion/src/simulator/external/sdl/include/SDL_stdinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,13 @@ typedef uint64_t Uint64;
#endif
#endif /* SDL_DISABLE_ANALYZE_MACROS */

#ifndef __3DS__
#define SDL_COMPILE_TIME_ASSERT(name, x) \
typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
typedef int SDL_dummy_ ## name[(x) * 2 - 1]
#else
#define SDL_COMPILE_TIME_ASSERT(name, x) \
typedef int SDL_dummy_ ## name[0]
#endif
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
Expand Down

0 comments on commit aadcd37

Please sign in to comment.