Skip to content

Commit

Permalink
[nx] deko3d imgui backend added
Browse files Browse the repository at this point in the history
added:
- deko3d imgui backend (thanks ftpd)
- controller input support

see #70
  • Loading branch information
ITotalJustice committed Apr 25, 2022
1 parent af798af commit 3b15899
Show file tree
Hide file tree
Showing 17 changed files with 1,662 additions and 31 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,4 @@ gba emulator witten in c++23.
- ocornut for imgui <https://github.com/ocornut/imgui>
- ocornut for imgui_club <https://github.com/ocornut/imgui_club>
- everyone that has contributed to the bios decomp <https://github.com/Gericom/gba_bios>
- [ftpd](https://github.com/mtheall/ftpd) and [nxshell](https://github.com/joel16/NX-Shell) for the deko3d backend for switch.
39 changes: 38 additions & 1 deletion src/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,13 @@ else()
target_link_libraries(main PRIVATE ${minizip_lib})
target_include_directories(main PRIVATE ${minizip_inc})

# on switch, i need to manually link against
# zlib as well, and has to be linked after minizip!
find_package(ZLIB REQUIRED)
target_link_libraries(main PRIVATE ZLIB::ZLIB)

set(FOUND_MINIZIP TRUE)
message(STATUS "using system minizip")
message(STATUS "using system minizip lib: ${minizip_lib} inc: ${minizip_inc}")
endif()
endif()

Expand Down Expand Up @@ -127,3 +132,35 @@ target_compile_definitions(main PRIVATE
DUMP_AUDIO=$<BOOL:${DUMP_AUDIO}>
DEBUGGER=$<BOOL:${DEBUGGER}>
)

if (NINTENDO_SWITCH)
# create romfs folder
dkp_add_asset_target(main_romfs ${CMAKE_CURRENT_BINARY_DIR}/romfs)

# setup nacp
nx_generate_nacp(main.nacp
NAME "Notorious BEEG"
AUTHOR TotalJustice
VERSION 0.0.3
)

# create nro (final binary)
nx_create_nro(main
ICON ${CMAKE_SOURCE_DIR}/src/frontend/backend/nx/icon.jpg
NACP main.nacp
ROMFS main_romfs
)

# compile and add shaders to romfs
set(SHADER_FOLDER ${CMAKE_SOURCE_DIR}/src/frontend/backend/nx/shaders)

nx_add_shader_program(imgui_fsh ${SHADER_FOLDER}/imgui_fsh.glsl frag)
nx_add_shader_program(imgui_vsh ${SHADER_FOLDER}/imgui_vsh.glsl vert)

dkp_install_assets(main_romfs
DESTINATION shaders
TARGETS
imgui_fsh
imgui_vsh
)
endif()
6 changes: 5 additions & 1 deletion src/frontend/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
cmake_minimum_required(VERSION 3.20.0)

add_subdirectory(sdl2)
if (NINTENDO_SWITCH)
add_subdirectory(nx)
else()
add_subdirectory(sdl2)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once

#include "../../system.hpp"
#include "../system.hpp"
#include <cstdint>
#include <span>
#include <utility>

namespace sys::backend::sdl2 {
namespace sys::backend {

[[nodiscard]] auto init() -> bool;
auto quit() -> void;
Expand All @@ -28,4 +28,4 @@ auto toggle_fullscreen() -> void;

auto open_url(const char* url) -> void;

} // sys::backend::sdl2
} // sys::backend
16 changes: 16 additions & 0 deletions src/frontend/backend/nx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.20.0)

add_library(backend
backend_nx.cpp
ftpd_imgui/imgui_deko3d.cpp
ftpd_imgui/imgui_nx.cpp
)

target_link_libraries(backend PRIVATE imgui)
target_link_libraries(backend PRIVATE GBA)
target_link_libraries(backend PRIVATE deko3dd)

# why is this even needed???
target_include_directories(backend PRIVATE ${DEVKITPRO}/portlibs/switch/include)

target_apply_lto_in_release(backend)
Loading

0 comments on commit 3b15899

Please sign in to comment.