Skip to content

Commit

Permalink
build libretro (related to #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
konsumer committed Jul 11, 2024
1 parent 9ba1964 commit d75369a
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 5 deletions.
Binary file modified docs/cart/colorbars.null0
Binary file not shown.
Binary file modified docs/cart/draw.null0
Binary file not shown.
Binary file modified docs/cart/filesystem.null0
Binary file not shown.
Binary file modified docs/cart/flappybird.null0
Binary file not shown.
Binary file modified docs/cart/hello.null0
Binary file not shown.
Binary file modified docs/cart/input.null0
Binary file not shown.
Binary file modified docs/cart/justlog.null0
Binary file not shown.
Binary file modified docs/cart/sound.null0
Binary file not shown.
Binary file modified docs/cart/tracker.null0
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/wasm/null0.mjs

Large diffs are not rendered by default.

Binary file modified docs/wasm/null0.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion host/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (NULL0_HOST_TYPE_RETRO)
add_library(${PROJECT_NAME}_libretro src/main.c)
add_library(${PROJECT_NAME}_libretro SHARED src/main.c)
find_package(libretrocommon QUIET)
target_link_libraries(${PROJECT_NAME}_libretro
null0_api
Expand Down
2 changes: 2 additions & 0 deletions host/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pntr_app Main(int argc, char* argv[]) {
filename = argv[1];
}

printf("Pixel format: %d\n", PNTR_PIXELFORMAT);

#ifdef PNTR_APP_RAYLIB
SetTraceLogLevel(LOG_WARNING);
#endif
Expand Down
8 changes: 8 additions & 0 deletions null0_api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@ endif()

if (NULL0_HOST_TYPE_RETRO)
find_package(libretrocommon QUIET)

add_library(libretro-audio ${libretrocommon_SOURCE_DIR}/audio/audio_mixer.c ${libretrocommon_SOURCE_DIR}/audio/conversion/float_to_s16.c ${libretrocommon_SOURCE_DIR}/memmap/memalign.c)
target_include_directories(libretro-audio PRIVATE
${libretrocommon_SOURCE_DIR}
${libretrocommon_SOURCE_DIR}/include
)

target_link_libraries(null0_api
pntr
pntr_app
physfs-static
libretro-audio
)
target_include_directories(null0_api PRIVATE
${libretrocommon_SOURCE_DIR}/include
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"type": "module",
"main": "node/index.js",
"scripts": {
"clean": "rimraf build wbuild docs/cart docs/wasm",
"clean": "rimraf build wbuild",
"start:server": "live-server docs",
"build:retro": "cmake -GNinja -B build -DCARTS=OFF -DHOST_TYPE=RETRO && cmake --build build",
"build:carts": "cmake -GNinja -B build -DCARTS=ON -DHOST_TYPE=OFF && cmake --build build",
"build:host": "cmake -GNinja -B build -DCARTS=OFF -DHOST_TYPE=RAYLIB && cmake --build build",
"build:web": "emcmake cmake -GNinja -B wbuild && cmake --build wbuild",
"build:site": "mkdir -p docs/wasm docs/cart && emcmake cmake -GNinja -B wbuild -DCARTS=ON && cmake --build wbuild && cp wbuild/host/null0.* docs/wasm && cp wbuild/cart/c/*.null0 docs/cart",
"watch:site": "npm-watch build:site",
"start": "run-p watch:site start:server"
"start": "run-p watch:site start:server"
},
"watch": {
"build:site": {
Expand Down
2 changes: 1 addition & 1 deletion tools/cmake/Findnull0.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ if(HOST_TYPE)
endif()

if (NULL0_HOST_TYPE_RETRO)
add_definitions(-DPNTR_APP_LIBRETRO -DPNTR_PIXELFORMAT_RGBA)
add_definitions(-DPNTR_APP_LIBRETRO -DPNTR_PIXELFORMAT_ARGB)
endif()

set(PHYSFS_ARCHIVE_7Z CACHE INTERNAL FALSE)
Expand Down

0 comments on commit d75369a

Please sign in to comment.