ref: 055ccfcb4cf6ac4a5c13451b784d370066d56bc0
parent: 309f665619968cee32bbab4a996cea86121ed76f
parent: 30044da7a1bf15611573c1445907e795d5a048b4
author: Chris Moeller <kode54@gmail.com>
date: Wed Jun 29 17:57:00 EDT 2016
Merge branch 'master' of github.com:kode54/dumb
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,7 +117,7 @@
)
set(INSTALL_HEADERS
- ../include/dumb.h
+ include/dumb.h
)
set(ALLEGRO_SOURCES
@@ -139,16 +139,13 @@
add_library(dumb ${SOURCES})
set_target_properties(dumb PROPERTIES DEBUG_POSTFIX d)
-set(ALLEGRO4_TARGETS "")
if(BUILD_ALLEGRO4)
add_library(aldmb ${ALLEGRO_SOURCES})
- set(ALLEGRO4_TARGETS ${ALLEGRO_TARGETS} aldmb)
- set(ALLEGRO4_HEADERS indclude/aldumb.h)
+ list(APPEND DUMB_TARGETS aldmb)
+ list(APPEND INSTALL_HEADERS include/aldumb.h)
target_link_libraries(aldmb ${ALLEGRO_LIBRARIES})
endif()
-set(EXAMPLE_TARGETS "")
-
if(BUILD_EXAMPLES)
add_executable(dumbout examples/dumbout.c)
add_executable(dumbplay examples/dumbplay.c)
@@ -162,7 +159,7 @@
target_link_libraries(dumbplay ${ARGTABLE2_LIBRARY} ${SDL2_LIBRARY} dumb)
include_directories(${ARGTABLE2_INCLUDE_DIR} ${SDL2_INCLUDE_DIR} "examples/")
- set(EXAMPLE_TARGETS ${EXAMPLE_TARGETS} "dumbout" "dumbplay")
+ list(APPEND DUMB_TARGETS "dumbout" "dumbplay")
endif()
# Make sure the dylib install name path is set on OSX so you can include dumb in app bundles
@@ -172,8 +169,8 @@
target_link_libraries(dumb m)
-INSTALL(FILES ${INSTALL_HEADERS} ${ALLEGRO_HEADERS} DESTINATION include/)
-INSTALL(TARGETS dumb ${EXAMPLE_TARGETS}
+INSTALL(FILES ${INSTALL_HEADERS} DESTINATION include/)
+INSTALL(TARGETS dumb ${DUMB_TARGETS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib${LIB_SUFFIX}
ARCHIVE DESTINATION lib${LIB_SUFFIX}
--- a/cmake-scripts/FindAllegro4.cmake
+++ b/cmake-scripts/FindAllegro4.cmake
@@ -5,12 +5,6 @@
# ALLEGRO_LIBRARIES - List of libraries when using allegro.
# ALLEGRO_FOUND - True if allegro found.
-
-IF (ALLEGRO_INCLUDE_DIR)
- # Already in cache, be silent
- SET(ALLEGRO_FIND_QUIETLY TRUE)
-ENDIF (ALLEGRO_INCLUDE_DIR)
-
FIND_PATH(ALLEGRO_INCLUDE_DIR allegro.h
/usr/local/include
/usr/include
@@ -35,17 +29,13 @@
ENDIF (ALLEGRO_INCLUDE_DIR AND ALLEGRO_LIBRARY)
IF (ALLEGRO_FOUND)
- IF (NOT ALLEGRO_FIND_QUIETLY)
- MESSAGE(STATUS "Found Allegro: ${ALLEGRO_LIBRARY}")
- ENDIF (NOT ALLEGRO_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Allegro: ${ALLEGRO_LIBRARY}")
ELSE (ALLEGRO_FOUND)
- IF (ALLEGRO_FIND_REQUIRED)
- MESSAGE(STATUS "Looked for Allegro libraries named ${ALLEGRO_NAMES}.")
- MESSAGE(FATAL_ERROR "Could NOT find Allegro library")
- ENDIF (ALLEGRO_FIND_REQUIRED)
+ MESSAGE(STATUS "Looked for Allegro libraries named ${ALLEGRO_NAMES}.")
+ MESSAGE(FATAL_ERROR "Could NOT find Allegro library")
ENDIF (ALLEGRO_FOUND)
MARK_AS_ADVANCED(
ALLEGRO_LIBRARY
ALLEGRO_INCLUDE_DIR
-)
\ No newline at end of file
+)
--- a/src/allegro/packfile.c
+++ b/src/allegro/packfile.c
@@ -30,12 +30,12 @@
} dumb_packfile;
-static void *dumb_packfile_open_ex(PACKFILE *p)
+static void *dumb_packfile_open_ex(PACKFILE *p, long size)
{
dumb_packfile * file = ( dumb_packfile * ) malloc( sizeof(dumb_packfile) );
if ( !file ) return 0;
file->p = p;
- file->size = file_size_ex(filename);
+ file->size = size;
file->pos = 0;
return file;
}
@@ -43,7 +43,7 @@
static void *dumb_packfile_open(const char *filename)
{
PACKFILE *p = pack_fopen(filename, F_READ);
- if (p) return dumb_packfile_open_ex(p);
+ if (p) return dumb_packfile_open_ex(p, file_size_ex(filename));
else return 0;
}
@@ -132,10 +132,11 @@
};
+/* XXX no way to get the file size from an existing PACKFILE without reading the entire contents first */
DUMBFILE *dumbfile_open_packfile(PACKFILE *p)
{
- return dumbfile_open_ex(dumb_packfile_open_ex(p), &packfile_dfs_leave_open);
+ return dumbfile_open_ex(dumb_packfile_open_ex(p, 0x7fffffff), &packfile_dfs_leave_open);
}
@@ -142,5 +143,5 @@
DUMBFILE *dumbfile_from_packfile(PACKFILE *p)
{
- return p ? dumbfile_open_ex(dumb_packfile_open_ex(p), &packfile_dfs) : NULL;
+ return p ? dumbfile_open_ex(dumb_packfile_open_ex(p, 0x7fffffff), &packfile_dfs) : NULL;
}