Skip to content

Commit

Permalink
Allegro 4.4 support for ZC
Browse files Browse the repository at this point in the history
  • Loading branch information
evouga committed Dec 30, 2016
1 parent 20cc52e commit f95b800
Show file tree
Hide file tree
Showing 19 changed files with 71 additions and 9 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ include_directories(./include/gme)
set(ZCSOUNDSOURCES
src/zcmusic.cpp
src/zcmusicd.cpp
src/alleg_compat.cpp
)

set(ROMVIEW_MODULES
Expand Down Expand Up @@ -98,8 +99,8 @@ endif()
# Windows

if(MSVC)
set(ALLEGROLIB "$<$<CONFIG:DEBUG>:${CMAKE_SOURCE_DIR}/libs/win32dbg/alld_crt.lib>"
"$<$<CONFIG:RELEASE>:${CMAKE_SOURCE_DIR}/libs/win32/allegro-4.4.2-mt.lib>")
set(ALLEGROLIB "$<$<CONFIG:DEBUG>:${CMAKE_SOURCE_DIR}/libs/win32dbg/alleg44-debug.lib>"
"$<$<CONFIG:RELEASE>:${CMAKE_SOURCE_DIR}/libs/win32/alleg44.lib>")

add_definitions(-DALLEGRO_MSVC)

Expand Down
3 changes: 1 addition & 2 deletions allegro/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ if(WIN32)
find_package(DSound)
find_package(DXGuid)

if(NOT DDRAW_FOUND OR NOT DINPUT_FOUND OR NOT DSOUND_FOUND OR NOT DXGUID_FOUND)
if(NOT DINPUT_FOUND OR NOT DSOUND_FOUND OR NOT DXGUID_FOUND)
if(MSVC)
message(FATAL_ERROR
"DirectX required for Windows port. You might need to add DirectX include and lib directories to your INCLUDE and LIB environment variables.
Expand All @@ -606,7 +606,6 @@ if(WIN32)
endif()

include_directories(SYSTEM
${DDRAW_INCLUDE_DIR}
${DINPUT_INCLUDE_DIR}
${DSOUND_INCLUDE_DIR}
${DXGUID_INCLUDE_DIR}
Expand Down
4 changes: 2 additions & 2 deletions allegro/cmake/FindDInput.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ endif(DINPUT_INCLUDE_DIR)

# Makes my life easier.
if(MSVC)
set(HINT_INCLUDE "C:/Program Files/Microsoft DirectX SDK (August 2008)/Include")
set(HINT_LIB "C:/Program Files/Microsoft DirectX SDK (August 2008)/Lib")
set(HINT_INCLUDE "C:/Program Files/Microsoft DirectX SDK (August 2008)/Include" "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include")
set(HINT_LIB "C:/Program Files/Microsoft DirectX SDK (August 2008)/Lib" "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib")
endif(MSVC)

find_path(DINPUT_INCLUDE_DIR dinput.h
Expand Down
4 changes: 2 additions & 2 deletions allegro/cmake/FindDSound.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ endif(DSOUND_INCLUDE_DIR)

# Makes my life easier.
if(MSVC)
set(HINT_INCLUDE "C:/Program Files/Microsoft DirectX SDK (August 2008)/Include")
set(HINT_LIB "C:/Program Files/Microsoft DirectX SDK (August 2008)/Lib")
set(HINT_INCLUDE "C:/Program Files/Microsoft DirectX SDK (August 2008)/Include" "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include")
set(HINT_LIB "C:/Program Files/Microsoft DirectX SDK (August 2008)/Lib" "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib")
endif(MSVC)

find_path(DSOUND_INCLUDE_DIR dsound.h
Expand Down
2 changes: 1 addition & 1 deletion allegro/cmake/FindDXGuid.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

if(MSVC)
find_library(DXGUID_LIBRARY NAMES dxguid
PATHS "C:/Program Files/Microsoft DirectX SDK (August 2008)/Lib"
PATHS "C:/Program Files/Microsoft DirectX SDK (August 2008)/Lib" "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Lib"
PATH_SUFFIXES x86 x64
)
else()
Expand Down
4 changes: 4 additions & 0 deletions allegro/include/allegro/platform/almsvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@
#define INLINE __inline

#define LONG_LONG __int64

/* Why does Allegro always insist on doing this? Sigh... -DD */
#if _MSC_VER <= 1600
#define int64_t signed __int64
#define uint64_t unsigned __int64
#endif

#define AL_CONST const

Expand Down
17 changes: 17 additions & 0 deletions allegro/include/allegro/platform/alplatf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* #undef ALLEGRO_BCC32 */
/* #undef ALLEGRO_BEOS */
/* #undef ALLEGRO_DJGPP */
/* #undef ALLEGRO_DMC */
/* #undef ALLEGRO_HAIKU */
/* #undef ALLEGRO_MACOSX */
/* #undef ALLEGRO_MINGW32 */
/* #undef ALLEGRO_MPW */
/* #define ALLEGRO_MSVC */
/* #undef ALLEGRO_PSP */
/* #undef ALLEGRO_QNX */
/* #undef ALLEGRO_UNIX */
/* #undef ALLEGRO_WATCOM */

/* These are always defined now. */
#define ALLEGRO_NO_ASM
#define ALLEGRO_USE_C
Binary file removed bin/win32/alleg42.dll
Binary file not shown.
Binary file added bin/win32/alleg44-debug.dll
Binary file not shown.
Binary file added bin/win32/alleg44.dll
Binary file not shown.
Binary file added libs/win32/alleg44.lib
Binary file not shown.
Binary file removed libs/win32dbg/alld_crt.lib
Binary file not shown.
Binary file added libs/win32dbg/alleg44-debug.lib
Binary file not shown.
1 change: 1 addition & 0 deletions modules/romview/RomviewCore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(ROMVIEW_CORE_SOURCES

src/zsys.cpp
src/romview.cpp
src/alleg_compat.cpp

## End of Romview Core module
)
1 change: 1 addition & 0 deletions modules/zelda/ZeldaCore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ src/zc_init.cpp
src/zc_items.cpp
src/init.cpp
src/win32.cpp
src/alleg_compat.cpp

## End of Zelda Core module
)
Expand Down
1 change: 1 addition & 0 deletions modules/zquest/ZQuestCore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ src/sprite.cpp
src/subscr.cpp
src/zc_custom.cpp
src/init.cpp
src/alleg_compat.cpp

## End of ZQuest Core module
)
Expand Down
20 changes: 20 additions & 0 deletions src/alleg_compat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//--------------------------------------------------------
// Zelda Classic
//
// alleg_compat.cpp
//
// Compatibility between allegro versions.
//
//--------------------------------------------------------

#include <allegro.h>

PACKFILE *pack_fopen_password(const char *filename, const char *mode, const char *password) {
packfile_password(password);
return pack_fopen(filename, mode);
}

uint64_t file_size_ex_password(const char *filename, const char *password) {
packfile_password(password);
return file_size_ex(filename);
}
16 changes: 16 additions & 0 deletions src/alleg_compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//--------------------------------------------------------
// Zelda Classic
//
// alleg_compat.h
//
// Compatibility between allegro versions.
//
//--------------------------------------------------------

#ifndef _ZC_ALLEG_COMPAT_H_
#define _ZC_ALLEG_COMPAT_H_

PACKFILE *pack_fopen_password(const char *filename, const char *mode, const char *password);
uint64_t file_size_ex_password(const char *filename, const char *password);

#endif // _ZC_ALLEG_COMPAT_H_
2 changes: 2 additions & 0 deletions src/zc_alleg.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@

#define DEBUGMODE
#define ALLEGRO_NO_COMPATIBILITY

#include <allegro.h>
#include <allegro/internal/aintern.h>
#include "alleg_compat.h"

#ifdef __cplusplus
INLINE fix abs(fix f)
Expand Down

0 comments on commit f95b800

Please sign in to comment.