Skip to content

Commit

Permalink
Merge pull request #40 from iyzsong/master
Browse files Browse the repository at this point in the history
libretro: Enable support for nt2,nt3 and LUA
  • Loading branch information
YuriSizuku authored Dec 1, 2024
2 parents ffc59cd + 5150584 commit 3ae64f1
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
[submodule "src/onsyuri_libretro/deps/bzip2"]
path = src/onsyuri_libretro/deps/bzip2
url = https://github.com/libarchive/bzip2.git
[submodule "src/onsyuri_libretro/deps/lua"]
path = src/onsyuri_libretro/deps/lua
url = https://github.com/lua/lua.git
48 changes: 47 additions & 1 deletion src/onsyuri_libretro/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,50 @@ target_include_directories(bzip2 PUBLIC
deps/bzip2
)

add_library(lua STATIC
deps/lua/lapi.c
deps/lua/lcode.c
deps/lua/lctype.c
deps/lua/ldebug.c
deps/lua/ldo.c
deps/lua/ldump.c
deps/lua/lfunc.c
deps/lua/lgc.c
deps/lua/llex.c
deps/lua/lmem.c
deps/lua/lobject.c
deps/lua/lopcodes.c
deps/lua/lparser.c
deps/lua/lstate.c
deps/lua/lstring.c
deps/lua/ltable.c
deps/lua/ltm.c
deps/lua/lundump.c
deps/lua/lvm.c
deps/lua/lzio.c
deps/lua/ltests.c
deps/lua/lauxlib.c
deps/lua/lbaselib.c
deps/lua/ldblib.c
deps/lua/liolib.c
deps/lua/lmathlib.c
deps/lua/loslib.c
deps/lua/ltablib.c
deps/lua/lstrlib.c
deps/lua/lutf8lib.c
deps/lua/lbitlib.c
deps/lua/loadlib.c
deps/lua/lcorolib.c
deps/lua/linit.c
)
target_compile_definitions(lua PRIVATE
LUA_COMPAT_5_2
)
target_include_directories(lua PUBLIC
deps/lua
)
target_link_libraries(lua PUBLIC m)

if (LIBRETRO_STATIC)
add_library(onsyuri_libretro STATIC ${SOURCES})
else ()
Expand All @@ -296,15 +340,17 @@ else ()
endif ()

target_link_libraries(onsyuri_libretro
bzip2 sdl2 sdl2_image sdl2_mixer sdl2_ttf
bzip2 sdl2 sdl2_image sdl2_mixer sdl2_ttf lua
)

target_include_directories(onsyuri_libretro PRIVATE
../onsyuri
deps
)
target_compile_definitions(onsyuri_libretro PRIVATE
__LIBRETRO__
USE_BUILTIN_LAYER_EFFECTS ENABLE_1BYTE_CHAR
USE_LUA
)
if (HAVE_NEON)
target_compile_definitions(onsyuri_libretro PRIVATE USE_SIMD USE_SIMD_ARM_NEON)
Expand Down
1 change: 1 addition & 0 deletions src/onsyuri_libretro/deps/lua
Submodule lua added at 75ea9c
9 changes: 9 additions & 0 deletions src/onsyuri_libretro/deps/lua.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// lua.hpp
// Lua header files for C++
// <<extern "C">> not supplied automatically because Lua also compiles as C++

extern "C" {
#include "lua/lua.h"
#include "lua/lualib.h"
#include "lua/lauxlib.h"
}
12 changes: 8 additions & 4 deletions src/onsyuri_libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ void
retro_get_system_info(struct retro_system_info* info)
{
info->need_fullpath = true;
info->valid_extensions = "txt|dat|___";
info->library_version = "0.7.4+1";
info->valid_extensions = "txt|dat|___|nt2|nt3|ons|/";
info->library_version = "0.7.4+2";
info->library_name = "onsyuri";
info->block_extract = false;
}
Expand Down Expand Up @@ -187,8 +187,12 @@ retro_load_game(const struct retro_game_info* game)
if (!game)
return false;

char* gamedir = dirname(SDL_strdup(game->path));
chdir(gamedir);
if (game->path[SDL_strlen(game->path) - 1] == '/') {
chdir(game->path);
} else {
char* gamedir = dirname(SDL_strdup(game->path));
chdir(gamedir);
}

// Ignore SDL_AUDIODRIVER and SDL_VIDEODRIVER.
SDL_SetHintWithPriority(SDL_HINT_AUDIODRIVER, "libretro", SDL_HINT_OVERRIDE);
Expand Down
4 changes: 2 additions & 2 deletions src/onsyuri_libretro/onsyuri_libretro.info
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Software Information
display_name = "ONScripter Yuri"
display_version = "0.7.4+1"
display_version = "0.7.4+2"
authors = "Studio O.G.A.|jh10001|YuriSizuku"
categories = "Game engine"
license = "GPLv2+"
permissions = ""
supported_extensions = "txt|dat|___|ons"
supported_extensions = "txt|dat|___|nt2|nt3|ons|/"

# Hardware Information
manufacturer = "ONScripter"
Expand Down

0 comments on commit 3ae64f1

Please sign in to comment.