Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for a C API. #152

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
578447f
Started working on a C API.
eaplatanios Apr 4, 2019
da13cf8
Added support for search structs to the C API.
eaplatanios Apr 4, 2019
beff4ca
Added support for some missing GameData functions to the C API.
eaplatanios Apr 4, 2019
132e1aa
Added support for memory view structs to the C API.
eaplatanios Apr 4, 2019
3f858d2
Added most of the missing functionality to the C API.
eaplatanios Apr 4, 2019
feb9509
Switched to using spaces for indentation.
eaplatanios Apr 4, 2019
d0881e9
Added support for some more of the missing functions to the C API.
eaplatanios Apr 5, 2019
fb4e05d
Added support for one more of the missing functions to the C API.
eaplatanios Apr 5, 2019
e45dea1
Added the last missing functions to the C API.
eaplatanios Apr 5, 2019
c994fb4
Made some fixes.
eaplatanios Apr 5, 2019
485cbe6
Avoided copies.
eaplatanios Apr 5, 2019
4510dc9
Exported the C API symbols.
eaplatanios Apr 5, 2019
5ade211
Changed exception handling in the C API (more principled approaching …
eaplatanios Apr 5, 2019
a1d2e73
Minor edits.
eaplatanios Apr 6, 2019
b9642fe
Minor edits.
eaplatanios Apr 6, 2019
3c12301
Minor edit.
eaplatanios Apr 6, 2019
82250d6
Another small update.
eaplatanios Apr 6, 2019
be16d35
Reproducible bug.
eaplatanios Apr 7, 2019
2b0413e
Made some memory bug fixes.
eaplatanios Apr 7, 2019
ab5a272
Fixed another memory issue.
eaplatanios Apr 7, 2019
c8a1b5f
Fixed yet another memory issue.
eaplatanios Apr 7, 2019
592ef22
Fixed yet another memory issue.
eaplatanios Apr 7, 2019
91512db
Fixed some more memory errors.
eaplatanios Apr 7, 2019
672e244
Fixed Linux compilation error.
eaplatanios Apr 7, 2019
8fd553b
Minor edit.
eaplatanios Apr 7, 2019
9f9b7d4
Some more minor edits.
eaplatanios Apr 8, 2019
d2b063f
Switched to using 'strdup'.
eaplatanios Apr 9, 2019
a3a075f
Made the 'add_definitions' shared across BUILD_PYTHON and BUILD_C.
eaplatanios Apr 13, 2019
706c238
Addressed some of @endrift's comments.
eaplatanios Apr 13, 2019
845a0ac
Addressed the remaining of @endrift's comments.
eaplatanios Apr 13, 2019
0a96f8c
Added support for deleting the obtained emulator screen.
eaplatanios Jul 20, 2019
92316e0
Added some more missing 'delete' functions.
eaplatanios Jul 20, 2019
d3f5b14
Added support for installing the retro C API using pkgconfig.
eaplatanios Jul 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ option(BUILD_TESTS "Should tests be built" ON)
option(BUILD_UI "Should integration UI be built" OFF)
option(BUILD_LUAJIT "Should static LuaJIT be used instead of system Lua" ON)
option(BUILD_MANYLINUX "Should use static libraries compatible with manylinux1" OFF)
option(BUILD_C "Build C API" OFF)

set(BUILD_PYTHON ON CACHE BOOL "Build Python module")
mark_as_advanced(BUILD_PYTHON)
Expand Down Expand Up @@ -285,6 +286,19 @@ if(BUILD_PYTHON)
target_link_libraries(retro retro-base ${PYBIND_LIBS} ${STATIC_LDFLAGS})
endif()

if(BUILD_C)
add_library(retro-c SHARED src/retro-c.cpp)
set_target_properties(retro-c PROPERTIES
OUTPUT_NAME retro
CXX_VISIBILITY_PRESET default)
if(WIN32)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
add_definitions(-DMS_WIN64)
eaplatanios marked this conversation as resolved.
Show resolved Hide resolved
endif()
endif()
target_link_libraries(retro-c retro-base ${STATIC_LDFLAGS})
endif()

if(BUILD_TESTS)
enable_testing()
add_subdirectory(third-party/gtest/googlemock)
Expand Down
2 changes: 1 addition & 1 deletion src/coreinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ bool loadCoreInfo(const string& jsonData) {
for (auto ext = core->at("ext").cbegin(); ext != core->at("ext").cend(); ++ext) {
s_extensionToCore[*ext] = core.key();
}
s_coreToLib[core.key()] = core->at("lib");
s_coreToLib[core.key()] = core->at("lib").get<string>();
eaplatanios marked this conversation as resolved.
Show resolved Hide resolved
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/emulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ bool Emulator::cbEnvironment(unsigned cmd, void* data) {
return false;
}
case RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY:
*reinterpret_cast<const char**>(data) = corePath().c_str();
*reinterpret_cast<const char**>(data) = strdup(corePath().c_str());
eaplatanios marked this conversation as resolved.
Show resolved Hide resolved
return true;
case RETRO_ENVIRONMENT_GET_CAN_DUPE:
*reinterpret_cast<bool*>(data) = true;
Expand Down
Loading