Skip to content

Commit

Permalink
Fix capsimg (BlitterStudio#1374)
Browse files Browse the repository at this point in the history
* Remove capsimg submodule

* Add capsimg sources

* Add dependencies in Makefile and CMakeLists.txt to build libcapsimage.so

* Fix path in makefile

* Add libs to make clean also

* Automatically build capsimg as well

* Remove extra step to build capsimg from pipeline
  • Loading branch information
midwan committed Jun 27, 2024
1 parent 1c0c07c commit 471fb51
Show file tree
Hide file tree
Showing 68 changed files with 14,716 additions and 36 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ jobs:
brew upgrade
brew install autoconf sdl2 mpg123 sdl2_ttf sdl2_image flac libmpeg2 libserialport portmidi dylibbundler wget
- name: make capsimg
run: make capsimg

- name: make for macOS X64
run: make -j4 PLATFORM=osx-x86

Expand Down Expand Up @@ -78,9 +75,6 @@ jobs:
brew upgrade
brew install autoconf sdl2 mpg123 sdl2_ttf sdl2_image flac libmpeg2 libserialport portmidi dylibbundler wget
- name: make capsimg
run: make capsimg

- name: make for macOS Apple Silicon
run: make -j4 PLATFORM=osx-m1

Expand Down Expand Up @@ -119,7 +113,6 @@ jobs:
image: midwan/amiberry-debian-x86_64:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=x86-64
- name: Upload artifact
Expand Down Expand Up @@ -169,7 +162,6 @@ jobs:
image: midwan/amiberry-debian-x86_64:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=x86-64
- name: Upload artifact
Expand Down Expand Up @@ -214,9 +206,6 @@ jobs:
with:
submodules: 'true'

- name: make capsimg
run: make capsimg

- name: build for RPI4 64-bit
run: make -j4 PLATFORM=rpi4-64-sdl2

Expand Down Expand Up @@ -267,7 +256,6 @@ jobs:
image: midwan/amiberry-debian-aarch64:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi5-64-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -318,7 +306,6 @@ jobs:
image: midwan/amiberry-debian-armhf:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi5-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -368,7 +355,6 @@ jobs:
image: midwan/amiberry-debian-aarch64:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi4-64-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -419,7 +405,6 @@ jobs:
image: midwan/amiberry-debian-armhf:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi4-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -469,7 +454,6 @@ jobs:
image: midwan/amiberry-debian-aarch64:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi4-64-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -520,7 +504,6 @@ jobs:
image: midwan/amiberry-debian-armhf:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi4-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -571,7 +554,6 @@ jobs:
image: midwan/amiberry-debian-aarch64:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi3-64-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -622,7 +604,6 @@ jobs:
image: midwan/amiberry-debian-armhf:bullseye
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi3-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -673,7 +654,6 @@ jobs:
image: midwan/amiberry-debian-aarch64:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi3-64-sdl2
- name: Upload artifact
Expand Down Expand Up @@ -724,7 +704,6 @@ jobs:
image: midwan/amiberry-debian-armhf:bookworm
options: -v ${{ github.workspace }}:/build
run: |
make capsimg
make -j8 PLATFORM=rpi3-sdl2
- name: Upload artifact
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "external/capsimg"]
path = external/capsimg
url = https://github.com/FrodeSolheim/capsimg
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ find_library(LIBMPEG2 mpeg2 REQUIRED)
set(libmt32emu_SHARED FALSE)
add_subdirectory(external/mt32emu)
add_subdirectory(external/floppybridge)
add_subdirectory(external/capsimage)
add_subdirectory(external/libguisan)

target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIRS} src src/osdep src/include src/threaddep src/archivers external/libguisan/include external/mt32emu/src external/floppybridge/src)
Expand Down Expand Up @@ -438,7 +439,12 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/whdboot $<TARGET_FILE_DIR:${PROJECT_NAME}>/whdboot)

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/external/floppybridge/libfloppybridge.so $<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/
DEPENDS external/floppybridge)
DEPENDS external/floppybridge)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_BINARY_DIR}/external/capsimage/libcapsimage.so $<TARGET_FILE_DIR:${PROJECT_NAME}>/plugins/
DEPENDS external/capsimage)
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ endif

DEPS = $(OBJS:%.o=%.d) $(C_OBJS:%.o=%.d)

$(PROG): $(OBJS) $(C_OBJS) guisan mt32emu floppybridge
$(PROG): $(OBJS) $(C_OBJS) guisan mt32emu floppybridge capsimg
$(CXX) -o $(PROG) $(OBJS) $(C_OBJS) $(LDFLAGS)
ifndef DEBUG
# want to keep a copy of the binary before stripping? Then enable the below line
Expand All @@ -681,6 +681,10 @@ clean:
$(MAKE) -C external/libguisan clean && $(RM) external/libguisan/libguisan.a
$(RM) -r external/mt32emu/build
$(RM) external/mt32emu/libmt32emu.a
$(RM) -r external/floppybridge/build
$(RM) external/floppybridge/libfloppybridge.so
$(RM) -r external/capsimage/build
$(RM) external/capsimage/libcapsimage.so

cleanprofile:
$(RM) $(OBJS:%.o=%.gcda)
Expand All @@ -706,7 +710,8 @@ floppybridge:

# The CAPSImg library that Amiberry uses, for accessing IPF disk images
capsimg:
cd external/capsimg && ./bootstrap && ./configure && $(MAKE)
cp external/capsimg/capsimg.so ./plugins
cmake -DCMAKE_BUILD_TYPE=Release -S external/capsimage -B external/capsimage/build
cmake --build external/capsimage/build --target all --parallel
cp external/capsimage/build/libcapsimage.so ./plugins

-include $(DEPS)
7 changes: 7 additions & 0 deletions external/capsimage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.*
!.gitignore
!.travis.yml
Thumbs.db
/out
/CMakeSettings.json
/Releases
84 changes: 84 additions & 0 deletions external/capsimage/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
cmake_minimum_required(VERSION 3.3)
project(capsimage)

set(PROJECT_TITLE CAPSImage)
set(PROJECT_TITLE_WIN32 CAPSImg)

set(MAJOR_VERSION 5)
set(MINOR_VERSION 1)

option(BUILD_SHARED_LIBS "Build a dynamic library instead of static library" ON)

if (APPLE)
option(BUILD_FRAMEWORK "Build a macOS framework instead of a shared library" OFF)
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(BUILD_SHARED_LIBS ON)
endif()

option(ADD_INCLUDE_SUFFIX "Add major version suffix to include directory" OFF)
if (ADD_INCLUDE_SUFFIX)
set(INCLUDE_SUFFIX ${MAJOR_VERSION})
message(STATUS "Using '${INCLUDE_SUFFIX}' suffix on include directory")
endif()

include(CheckStructHasMember)
CHECK_STRUCT_HAS_MEMBER("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYPE LANGUAGE CXX)

file(GLOB SOURCES src/Core/*.cpp src/CAPSImg/*.cpp src/Codec/*.cpp)
file(GLOB HEADERS src/Core/*.h src/CAPSImg/*.h src/Codec/*.h src/Device/*.h)
file(GLOB API_HEADERS src/LibIPF/*.h;src/Core/CommonTypes.h)
set(API_HEADERS ${API_HEADERS} ${CMAKE_BINARY_DIR}/CapsLibVersion.h)

add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${API_HEADERS})

#set_target_properties(${PROJECT_NAME} PROPERTIES
# VERSION ${MAJOR_VERSION}.${MINOR_VERSION}
# SOVERSION ${MAJOR_VERSION}
# CXX_STANDARD 11)

target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_BINARY_DIR}
src/LibIPF
src/CAPSImg
src/Core
src/Codec
src/Device)

if (APPLE AND BUILD_FRAMEWORK)
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME ${PROJECT_TITLE}
FRAMEWORK TRUE
FRAMEWORK_VERSION C
MACOSX_FRAMEWORK_IDENTIFIER com.kryoflux)
set_source_files_properties(${API_HEADERS} PROPERTIES
MACOSX_PACKAGE_LOCATION Headers/caps${INCLUDE_SUFFIX})
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
endif()

if (WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_TITLE_WIN32})
target_include_directories(${PROJECT_NAME} PRIVATE src/Compatibility)
endif()

configure_file(src/config.h.in ${CMAKE_BINARY_DIR}/config.h)
configure_file(src/LibIPF/CapsLibVersion.h.in ${CMAKE_BINARY_DIR}/CapsLibVersion.h)
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_CONFIG_H=1)

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
FRAMEWORK DESTINATION "/Library/Frameworks"
PUBLIC_HEADER DESTINATION include/caps${INCLUDE_SUFFIX})

if (NOT APPLE OR NOT BUILD_FRAMEWORK)
install(FILES ${API_HEADERS} DESTINATION include/caps${INCLUDE_SUFFIX})
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT BUILD_FRAMEWORK)
message(STATUS "macOS platform detected")
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND cp libcapsimage.dylib libcapsimage.so
COMMAND install_name_tool -id libcapsimage.so libcapsimage.so
)
endif ()
21 changes: 21 additions & 0 deletions external/capsimage/DONATIONS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Since the start of the project in 2001, much has happened. SPS has become a well known institution among game collectors and computer enthusiasts. IPF, the Interchangeable Preservation Format, is now established as the one to use for the original, unmodified gaming experience of computer games made for the Commodore Amiga. We have preserved more than 3,000 games so far, with new dumps coming in every day, and we expect this number to explode with multi format support. This means Acorn Electron, Apple, Amstrad CPC, Archimedes, Atari 8-bit, Atari ST, BBC, Commodore 64, Commodore Amiga, MSX, IBM PC, PC-8801, Sam Coupe, Spectrum,
and many others supported.

With the project expanding beyond the scope of the Commodore Amiga, we started developing a high definition flux imager for USB, called KryoFlux. Developing hardware with state of the art components is quite expensive, not counting the thousands of man-hours it takes to write good, reliable code that will work in the field and not only in a lab. Today, KryoFlux is a reality, but ongoing research and development again costs time and money.

KryoFlux is free for private, non-commercial use. If you look around, you won't find another combination of dumping hardware and software that is free. Why is that? Maybe it's like that because selling things to the retro community is a business that is viable. We think that preservation of computer art and software in general is too important to keep anyone from dumping by charging for the bridge which enables access to old media. We think it is ok to lock out those who do charge, and to charge those who do this for a living (e.g. data recovery companies), so we have chosen to restrict everything that is not private use. If you have a unit for personal use, please consider donating. It really raises morale.

What more would we want to do? A computer games history museum, open for everyone via the internet for virtual tours as well as a place to visit in real life, for those who would like to experience the games preserved in digital form first hand and see the boxes and disks or may even want to play them - not to mention having a friendly chat, and even competitions with fellow game enthusiasts. It's in fact sad to see that we can't do all these things full time, because we all have daytime jobs to secure our income. Some of us have jobs that would allow us to take unpaid vacation to some extent, from time to time, but how can you do this if you have to pay your bills? Some would even be willing to give up what they are doing now, to build up an international preservation approach. With the right tools, to make sure that items preserved are preserved the right way, unchanged and unaltered. Until today, our members have donated more than EUR 30,000 to this project. Several other individuals have donated as well, which is great and which we are very thankful for. You know, who you are. Thank you!

So if you like what you have seen, if you do play the games we preserved from the containers we created with the software we are providing and would like to see more games preserved: please help! Support for many 8-bit platforms is happening as you read these lines and we sometimes buy items for prices regarded insane years ago. Still that sealed copy might be the only one left. If you can give a dollar, please do. If you can afford more, we won't say no. Please don't go away with the opinion that others might be donating as much - they might think the same, too. Everyone can help, and the smallest donation helps for sure.

Please remember: A game not dumped today, might be gone forever. Prices for rare items increase every day and the games left are not going to be around for ever. Moisture and heat won't help either. Who knows how many "last copies" have been thrown away because they were mould-infested? It's evident that collectors, gamers and retro enthusiasts in general must work together quickly to make sure those gems from yesterday, joyful childhood memories, don't fade into oblivion. Who else can make sure that generations to come will know when and where computer gaming really started? And wouldn't it be nice if they could actually play the games instead of only reading about them?

So far we have preserved about 4.000 games in their pristine, unmodified glory. We developed a custom floppy controller that's been published with schematics and is free for private, non-commercial use. And we have released the sources for the IPF DECODER LIBRARY to make sure end users as well as libraries, archives and museums can make use of it. If you appreciate what we have been doing and giving and what we intend to do, please encourage us to carry on.

If you would like to help us on our software preservation crusade, you can do it using the link below. If you would prefer we used your donation for something in particular, please state this with your donation.

http://www.softpres.org/donate

Thank you for your support,
The Software Preservation Society
26 changes: 26 additions & 0 deletions external/capsimage/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

SPS DECODER LIBRARY
-=================-

HISTORY

2002-12-23 - Initial release
2003-04-02 - Added flakey/weak bit protection support, bitshifting support
2003-05-23 - Added memory mapped image support, Speedlock support
2003-07-05 - Now supports inconsistent gap lengths, a few other minor improvements
2003-07-14 - Updated: Amiga
2003-11-25 - Very small memory footprint & fast startup time, a few minor improvements
2004-02-13 - Multi-platform source port (Linux/Amiga)
2004-05-02 - New flakey bit API, related changes
2004-07-31 - Multiple interfaces, overlap/dropout access, version & capability info
2004-08-09 - Updated: Linux & Amiga
2004-09-27 - Support for more protection systems
2004-10-04 - Support for protection system on by Adam Brierley
2010-06-08 - Generic MFM support, comprehensive gap handling, WD177x FDC emulator
2011-07-11 - Helper functions to make KryoFlux write functionality easier
2014-06-14 - Direct support for CT RAW, major refactoring, migrated to SPStudio


--
The Software Preservation Society
http://www.softpres.org
48 changes: 48 additions & 0 deletions external/capsimage/LICENCE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
This licence is based on the MAME licence and is intended for use in all non-commercial projects and environments. Other licensing options are available. Don't hesitate - please contact us at licensing@kryoflux.com.


PREAMBLE

The purpose ("Purpose") of the SPS DECODER LIBRARY ("CLL", "CAPSImage", "CAPSImg", etc.) is to enable third party software to use The Software Preservation Society Interchangeable Preservation Format ("IPF"), Software Preservation Society Capture Tool RAW ("CT RAW", "RAW") and KryoFlux STREAM ("KF STREAM", "RAW") format files as produced by e.g. The Software Preservation Analyser, KryoFlux - High Definition Flux Sampler for USB or KryoFlux FREE.


LICENCE

Redistribution and use of the SPS DECODER LIBRARY code is permitted provided that the following conditions are met:

- Redistributions may not be sold, nor may they be used in a commercial product or activity.

- Redistributions that are modified from the original source must include the complete source code, including the source code for all components used by a binary built from the modified sources. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

- Aforementioned modifications to the code can be made to enhance the code or to make it compile on other platforms than originally supported. Modifications must still satisfy the Purpose. Any file formats other than those listed under Purpose must not be enabled through the SPS DECODER LIBRARY.

- Redistributions must reproduce the following copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


COPYRIGHT

SPS DECODER LIBRARY Copyright (c) 2001-2014 by Istv�n F�bi�n under exclusive licence to KryoFlux Products & Services Ltd, 80 Allington Way, Maidstone, ME16 0HN, United Kingdom. All rights reserved.


COMMON QUESTIONS

Q. Can I include the SPS DECODER LIBRARY with my commercial product?
A. No. The SPS DECODER LIBRARY is not licensed for commercial use. Using SPS DECODER LIBRARY as a "freebie" or including it at "no cost" with your product still constitutes commerical usage and is forbidden by the licence.

Q. Can I sell my product with the SPS DECODER LIBRARY or associated logos (e.g. SPS, KryoFlux) on it?
A. No. Putting the name or logo on your product makes it appear that the product is something officially endorsed.

Q. Can I use the SPS DECODER LIBRARY or the SPS logo to advertise my product?
A. No. Using the name or logo in your advertising makes it appear that the product is something officially endorsed.

Q. Can I use the term "SPS DECODER LIBRARY" in the name of my software?
A. Generally, no, especially if it is something that is sold. However, if you are producing a free SPS DECODER LIBRARY-related piece of software, it is common that permission is granted. Send a query to double-check first, please.

Q. Can I ask for donations for the work I did on my port of SPS DECODER LIBRARY to platform X?
A. No. You would be earning money from the SPS DECODER LIBRARY trademark and copyrights, and that would be a commercial use, which is prohibited by the licence. It is our wish that SPS DECODER LIBRARY remains free.

v1.02
2014-05-20

16 changes: 16 additions & 0 deletions external/capsimage/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SPS DECODER LIBRARY (SPStudio_Dev) v5.1 SOURCE CODE release package

This distribution contains the source code for the SPS DECODER LIBRARY v5.1 for Windows(tm), Mac OS X(tm) and Linux. This not free software, please read the licence.



If you encounter any problems, please let us know by posting here:

http://forum.kryoflux.com


Please use the forums for bug reports, do not submit tickets for this.


Thank you for your support,
The Software Preservation Society
Loading

0 comments on commit 471fb51

Please sign in to comment.