Skip to content

Commit

Permalink
Remove libtheora dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
MegAmi24 committed Nov 14, 2024
1 parent cc35998 commit 8fb61e8
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 100 deletions.
42 changes: 1 addition & 41 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(RETRO_FILES
Nexus/fcaseopen.c
Nexus/main.cpp
Nexus/Math.cpp
Nexus/ModAPI.cpp
Nexus/ModAPI.cpp
Nexus/Object.cpp
Nexus/Palette.cpp
Nexus/Player.cpp
Expand Down Expand Up @@ -114,46 +114,6 @@ if(COMPILE_VORBIS)
target_link_libraries(RetroEngine libvorbis libogg)
endif()

if(COMPILE_THEORA)
set(THEORA_DIR dependencies/${DEP_PATH}/libtheora)

add_library(libtheora STATIC
${THEORA_DIR}/lib/analyze.c
${THEORA_DIR}/lib/apiwrapper.c
${THEORA_DIR}/lib/bitpack.c
${THEORA_DIR}/lib/cpu.c
${THEORA_DIR}/lib/decapiwrapper.c
${THEORA_DIR}/lib/decinfo.c
${THEORA_DIR}/lib/decode.c
${THEORA_DIR}/lib/dequant.c
${THEORA_DIR}/lib/encapiwrapper.c
${THEORA_DIR}/lib/encfrag.c
${THEORA_DIR}/lib/encinfo.c
${THEORA_DIR}/lib/encode.c
${THEORA_DIR}/lib/encoder_disabled.c
${THEORA_DIR}/lib/enquant.c
${THEORA_DIR}/lib/fdct.c
${THEORA_DIR}/lib/fragment.c
${THEORA_DIR}/lib/huffdec.c
${THEORA_DIR}/lib/huffenc.c
${THEORA_DIR}/lib/idct.c
${THEORA_DIR}/lib/info.c
${THEORA_DIR}/lib/internal.c
${THEORA_DIR}/lib/mathops.c
${THEORA_DIR}/lib/mcenc.c
${THEORA_DIR}/lib/quant.c
${THEORA_DIR}/lib/rate.c
${THEORA_DIR}/lib/state.c
${THEORA_DIR}/lib/tokenize.c
)

target_compile_options(libtheora PRIVATE ${THEORA_FLAGS})

target_include_directories(libtheora PRIVATE ${THEORA_DIR}/include ${OGG_DIR}/include)
target_include_directories(RetroEngine PRIVATE ${THEORA_DIR}/include)
target_link_libraries(RetroEngine libtheora)
endif()

target_include_directories(RetroEngine PRIVATE
Nexus/
)
Expand Down
2 changes: 0 additions & 2 deletions Nexus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@
"$(PROJECT_DIR)/dependencies/mac/libvorbis-1.3.7/macosx",
"$(PROJECT_DIR)/dependencies/mac/libogg/macosx",
"$(PROJECT_DIR)/dependencies/mac/libvorbis/macosx",
"$(PROJECT_DIR)/dependencies/mac/libtheora/macosx",
);
INFOPLIST_FILE = "$(SRCROOT)/dependencies/mac/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -524,7 +523,6 @@
"$(PROJECT_DIR)/dependencies/mac/libvorbis-1.3.7/macosx",
"$(PROJECT_DIR)/dependencies/mac/libogg/macosx",
"$(PROJECT_DIR)/dependencies/mac/libvorbis/macosx",
"$(PROJECT_DIR)/dependencies/mac/libtheora/macosx",
);
INFOPLIST_FILE = "$(SRCROOT)/dependencies/mac/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
24 changes: 12 additions & 12 deletions Nexus/Nexus.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;USE_SW_REN;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies/windows/SDL2/include/;$(SolutionDir)dependencies/windows/libogg/include/;$(SolutionDir)dependencies/windows/libvorbis/include/;$(SolutionDir)dependencies/windows/libtheora/include/;$(SolutionDir)dependencies/all/theoraplay/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies/windows/SDL2/include/;$(SolutionDir)dependencies/windows/libogg/include/;$(SolutionDir)dependencies/windows/libvorbis/include/;$(SolutionDir)dependencies/all/theoraplay/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/libvorbis/win32/VS2010/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libtheora/win32/VS2008/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libogg/win32/VS2015/$(Platform)/$(Configuration)/</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;libogg.lib;libvorbis_static.lib;libvorbisfile_static.lib;libtheora_static.lib;Shell32.lib;Advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/libvorbis/win32/VS2010/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libogg/win32/VS2015/$(Platform)/$(Configuration)/</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;libogg.lib;libvorbis_static.lib;libvorbisfile_static.lib;Shell32.lib;Advapi32.lib</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)dependencies\windows\SDL2\lib\$(PlatformTargetAsMSBuildArchitecture)\SDL2.dll" "$(OutDir)" </Command>
Expand All @@ -123,14 +123,14 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;USE_SW_REN;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies/windows/SDL2/include/;$(SolutionDir)dependencies/windows/libogg/include/;$(SolutionDir)dependencies/windows/libvorbis/include/;$(SolutionDir)dependencies/windows/libtheora/include/;$(SolutionDir)dependencies/all/theoraplay/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies/windows/SDL2/include/;$(SolutionDir)dependencies/windows/libogg/include/;$(SolutionDir)dependencies/windows/libvorbis/include/;$(SolutionDir)dependencies/all/theoraplay/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/libvorbis/win32/VS2010/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libtheora/win32/VS2008/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libogg/win32/VS2015/$(Platform)/$(Configuration)/</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;libogg.lib;libvorbis_static.lib;libvorbisfile_static.lib;libtheora_static.lib;Shell32.lib;Advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/libvorbis/win32/VS2010/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libogg/win32/VS2015/$(Platform)/$(Configuration)/</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;libogg.lib;libvorbis_static.lib;libvorbisfile_static.lib;Shell32.lib;Advapi32.lib</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)dependencies\windows\SDL2\lib\$(PlatformTargetAsMSBuildArchitecture)\SDL2.dll" "$(OutDir)" </Command>
Expand All @@ -148,16 +148,16 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;USE_SW_REN;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies/windows/SDL2/include/;$(SolutionDir)dependencies/windows/libogg/include/;$(SolutionDir)dependencies/windows/libvorbis/include/;$(SolutionDir)dependencies/windows/libtheora/include/;$(SolutionDir)dependencies/all/theoraplay/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies/windows/SDL2/include/;$(SolutionDir)dependencies/windows/libogg/include/;$(SolutionDir)dependencies/windows/libvorbis/include/;$(SolutionDir)dependencies/all/theoraplay/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/libvorbis/win32/VS2010/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libtheora/win32/VS2008/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libogg/win32/VS2015/$(Platform)/$(Configuration)/</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;libogg.lib;libvorbis_static.lib;libvorbisfile_static.lib;libtheora_static.lib;Shell32.lib;Advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/libvorbis/win32/VS2010/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libogg/win32/VS2015/$(Platform)/$(Configuration)/</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;libogg.lib;libvorbis_static.lib;libvorbisfile_static.lib;Shell32.lib;Advapi32.lib</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)dependencies\windows\SDL2\lib\$(PlatformTargetAsMSBuildArchitecture)\SDL2.dll" "$(OutDir)" </Command>
Expand All @@ -173,16 +173,16 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;USE_SW_REN;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies/windows/SDL2/include/;$(SolutionDir)dependencies/windows/libogg/include/;$(SolutionDir)dependencies/windows/libvorbis/include/;$(SolutionDir)dependencies/windows/libtheora/include/;$(SolutionDir)dependencies/all/theoraplay/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)dependencies/windows/SDL2/include/;$(SolutionDir)dependencies/windows/libogg/include/;$(SolutionDir)dependencies/windows/libvorbis/include/;$(SolutionDir)dependencies/all/theoraplay/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/libvorbis/win32/VS2010/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libtheora/win32/VS2008/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libogg/win32/VS2015/$(Platform)/$(Configuration)/</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;libogg.lib;libvorbis_static.lib;libvorbisfile_static.lib;libtheora_static.lib;Shell32.lib;Advapi32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)dependencies/windows/SDL2/lib/$(PlatformTargetAsMSBuildArchitecture)/;$(SolutionDir)dependencies/windows/libvorbis/win32/VS2010/$(Platform)/$(Configuration)/;$(SolutionDir)dependencies/windows/libogg/win32/VS2015/$(Platform)/$(Configuration)/</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;libogg.lib;libvorbis_static.lib;libvorbisfile_static.lib;Shell32.lib;Advapi32.lib</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(SolutionDir)dependencies\windows\SDL2\lib\$(PlatformTargetAsMSBuildArchitecture)\SDL2.dll" "$(OutDir)" </Command>
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Clone the repo, using:
To handle dependencies, you'll need to install [Visual Studio Community](https://visualstudio.microsoft.com/downloads/) (make sure to install the `Desktop development with C++` package during the installation) and [vcpkg](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-cmd#1---set-up-vcpkg) (You only need to follow `1 - Set up vcpkg`).

After installing those, run the following in Command Prompt (make sure to replace `[vcpkg root]` with the path to the vcpkg installation!):
- `[vcpkg root]\vcpkg.exe install sdl2 libogg libvorbis libtheora --triplet=x64-windows-static` (If you're compiling a 32-bit build, replace `x64-windows-static` with `x86-windows-static`.)
- `[vcpkg root]\vcpkg.exe install sdl2 libogg libvorbis --triplet=x64-windows-static` (If you're compiling a 32-bit build, replace `x64-windows-static` with `x86-windows-static`.)

Finally, follow the [compilation steps below](#compiling) using `-DCMAKE_TOOLCHAIN_FILE=[vcpkg root]/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH=[vcpkg root]/installed/x64-windows-static/` as arguments for `cmake -B build`.
- Make sure to replace each instance of `[vcpkg root]` with the path to the vcpkg installation!
Expand All @@ -38,10 +38,10 @@ Finally, follow the [compilation steps below](#compiling) using `-DCMAKE_TOOLCHA

### Linux
Install the following dependencies: then follow the [compilation steps below](#compiling):
- **pacman (Arch):** `sudo pacman -S base-devel cmake sdl2 libogg libvorbis libtheora`
- **apt (Debian/Ubuntu):** `sudo apt install build-essential cmake libsdl2-dev libogg-dev libvorbis-dev libtheora-dev`
- **rpm (Fedora):** `sudo dnf install make gcc cmake sdl2-devel libogg-devel libvorbis-devel zlib-devel libtheora-devel`
- **apk (Alpine/PostmarketOS)** `sudo apk add build-base cmake sdl2-dev libogg-dev libvorbis-dev libtheora-dev`
- **pacman (Arch):** `sudo pacman -S base-devel cmake sdl2 libogg libvorbis`
- **apt (Debian/Ubuntu):** `sudo apt install build-essential cmake libsdl2-dev libogg-dev libvorbis-dev`
- **rpm (Fedora):** `sudo dnf install make gcc cmake sdl2-devel libogg-devel libvorbis-devel zlib-devel`
- **apk (Alpine/PostmarketOS)** `sudo apk add build-base cmake sdl2-dev libogg-dev libvorbis-dev`
- Your favorite package manager here, [make a pull request](https://github.com/RSDKModding/RSDKv2-Decompilation/fork)

## Compiling
Expand Down Expand Up @@ -71,7 +71,7 @@ Follow the installation instructions in the readme of each branch.
Because these branches are unofficial, we can't provide support for them and they may not be up-to-date.

## Other Platforms
Currently the only supported platforms are the ones listed above, however the backend uses libogg, libvorbis, libtheora & SDL2 to power it, so the codebase is very multiplatform.
Currently the only supported platforms are the ones listed above, however the backend uses libogg, libvorbis, & SDL2 to power it, so the codebase is very multiplatform.
If you're able to, you can clone this repo and port it to a platform not on the list.

# Contact:
Expand Down
3 changes: 0 additions & 3 deletions dependencies/mac/dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ download the libogg .zip file and unzip it in "./libogg/", then build the librar

libvorbis: https://xiph.org/downloads/ (libvorbis)
download the libogg .zip file and unzip it in "./libvorbis/", then build the library as a framework, and include it in the xcode proj

libtheora: https://xiph.org/downloads/ (libtheora)
download the libogg .zip file and unzip it in "./libtheora/", then build the library as a framework, and include it in the xcode proj
3 changes: 0 additions & 3 deletions dependencies/windows/dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ download libogg and unzip it in "./libogg/", then build the static library

libvorbis: https://xiph.org/downloads/ (libvorbis)
download libvorbis and unzip it in "./libvorbis/", then build the VS2010 static library (win32/VS2010/vorbis_static.sln)

libtheora: https://xiph.org/downloads/ (libtheora)
download libtheora and unzip it in "./libtheora/", then build the VS2008 static library (win32/VS2008/libtheora_static.sln)
12 changes: 0 additions & 12 deletions platforms/Linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ else()
target_compile_options(RetroEngine PRIVATE ${OGG_STATIC_CFLAGS})
endif()

pkg_check_modules(THEORA theora theoradec)

if(NOT THEORA_FOUND)
message("could not find libtheora, attempting to build manually")
set(COMPILE_THEORA TRUE)
else()
message("found libtheora")
target_link_libraries(RetroEngine ${THEORA_STATIC_LIBRARIES})
target_link_options(RetroEngine PRIVATE ${THEORA_STATIC_LDLIBS_OTHER})
target_compile_options(RetroEngine PRIVATE ${THEORA_STATIC_CFLAGS})
endif()

pkg_check_modules(VORBIS vorbis vorbisfile) #idk what the names are

if(NOT VORBIS_FOUND)
Expand Down
21 changes: 0 additions & 21 deletions platforms/Windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,6 @@ else()
target_link_libraries(RetroEngine libogg)
endif()

# i don't like this but it's what's on vcpkg so
find_package(unofficial-theora CONFIG)

if(NOT unofficial-theora_FOUND)
message(NOTICE "could not find libtheora from unofficial-theora, attempting to find through Theora")
find_package(Theora CONFIG)

if(NOT Theora_FOUND)
message("could not find libtheora, attempting to build manually")
set(COMPILE_THEORA TRUE)
else()
message("found libtheora")
add_library(libtheora ALIAS Theora::theora) # my best guess
target_link_libraries(RetroEngine libtheora)
endif()
else()
message("found libtheora")
add_library(libtheora ALIAS unofficial::theora::theora)
target_link_libraries(RetroEngine libtheora)
endif()

find_package(Vorbis CONFIG)

if(NOT ${Vorbis_FOUND})
Expand Down

0 comments on commit 8fb61e8

Please sign in to comment.