66 Commits

Author SHA1 Message Date
accf927874 Disable software drivers by default everywhere
They'll likely be dropped entirely soon.
2021-07-02 19:48:00 +02:00
d62e0424f2 Fix path issues when imported as subdirectory 2021-06-30 21:13:59 +02:00
924178ebf6 Set includes and libs on object targets
Instead of using the global `include_directories()` and
`link_libraries()` calls use the target versions
`target_include_directories()` and `target_include_libraries()` with
`PRIVATE` keyword instead.

The dependencies are libraries only, the headers are added to the build
instructions in a separate call. So the `target_link_libraries()` calls
are not needed for the object-libraries to be built.
2021-06-27 23:04:56 +02:00
78d1a3f73e Fix getViewPort returning incorrect results 2021-06-21 23:16:38 +02:00
b43f9b96e0 Fix incorrect documentation on setRenderTarget(Ex) 2021-06-21 08:25:36 +02:00
0500a7798b CXMeshFileLoader: initialize normals to zero during loading 2021-06-19 22:22:47 +02:00
c84d8acff9 CIrrDeviceWin32: readd fullscreen using borderless maximized window 2021-06-15 18:52:38 +02:00
02b8fc1ab6 CIrrDeviceWin32: drop all video mode code 2021-06-15 18:28:10 +02:00
57a51e7ac4 CIrrDeviceLinux: reimplement fullscreen using NetWM hint 2021-06-15 17:46:22 +02:00
39c45024ed CIrrDeviceLinux: drop all video mode support code 2021-06-15 17:36:31 +02:00
393793f28a Improved IrrlichtMt target structure (#31) 2021-05-24 20:32:26 +02:00
05c109a1d5 COGLES2Driver: fix swapped color screenshots 2021-05-08 20:57:24 +02:00
08057945f6 CI: Add verbose flag to build (#35) 2021-05-08 20:38:57 +02:00
04bc02fc22 Cleanup C++0x support in irrUString.h (#33) 2021-04-28 10:12:29 +02:00
341cdbfe0d Enable ogles2 on mobile platforms by default
It wasn't meant to be disabled.
2021-04-27 09:25:58 +02:00
826de9f6dc Work around bug installing targets created in a subdirectory 2021-04-24 11:03:09 +02:00
2461e899ba Add basic test application that runs under CI 2021-04-22 10:53:09 +02:00
5411ec4f03 Hook up examples to CMake 2021-04-22 09:43:53 +02:00
3152a6cc46 CNullDriver: store real size for dummy textures 2021-04-21 18:18:47 +02:00
688debb643 CIrrDeviceLinux: don't create input context if no window
This broke the Null driver.
2021-04-21 17:34:10 +02:00
21cb990e75 Fix misbehaving input after IME changes (Linux) 2021-04-19 21:41:51 +02:00
4719f3c114 Fix Android build (again)
closes #27
2021-04-17 17:47:09 +02:00
bd95662f03 WGLManager: fix wglCreateContextAttribsARB not being used 2021-04-17 16:07:17 +02:00
4c0aff5aa8 Always use system OpenGL extension headers 2021-04-17 00:05:46 +02:00
5bdcc7eb4f Fix include install location 2021-04-13 23:32:53 +02:00
9840eeabe8 CMake Config and Version exports (#22) 2021-04-13 21:08:16 +02:00
aa294a8107 Fix Android build 2021-04-09 21:28:31 +02:00
05547cbd5f Disable Software drivers on mobile platforms
literally dead code
2021-04-09 21:24:58 +02:00
4f90019dcb Fix segfault if non-i18n fallback input is used on Linux 2021-04-05 17:10:55 +02:00
c77797bbed Bump revision early
So we can leave CI at the last build while being able to test changes locally.
2021-04-02 23:38:28 +02:00
3ef5902815 Add support for IMEs on Linux 2021-04-02 23:17:27 +02:00
32004b9c5f Prepare GUI for IME support 2021-04-02 23:17:27 +02:00
d7127df9f8 Do not distort images scaled by integer multiples 2021-03-31 17:11:19 +02:00
3fb23fc423 Skip unnecessary C compiler checks 2021-03-26 23:08:09 +01:00
279530a230 Make compiling using MSVC work 2021-03-26 16:48:28 +01:00
f7b46ba22f Bump revision to 1.9.0mt1 2021-03-25 15:47:33 +01:00
f05f84b33b Rename library to IrrlichtMt
for clarity and to avoid conflicts
closes #16
2021-03-25 15:47:33 +01:00
3006362e25 Make Linux CI run upload a package 2021-03-25 15:40:12 +01:00
ff737e113c Include irrUString directly in irrlicht
it's a derivate from irrString and originate from irrlicht, legitimate a return back to home
2021-03-25 13:35:51 +01:00
8eaf3db05a Ignore all so, not only versioned ones 2021-03-25 13:35:51 +01:00
7c428c6dc2 CIrrDeviceLinux: fix dead key/compose handling 2021-03-25 12:30:52 +01:00
7f0e0a57b8 CIrrDeviceLinux: fix dumb key fallback behaviour
Turns out giving the application KEY_UNKNOWN + the correct char
to work with is better than returning nonsense EKEY_CODEs.
2021-03-24 20:14:46 +01:00
4bdd8af47d Fix missing step in build instructions 2021-03-18 12:57:17 +01:00
fa7a5dbdef Fix Irrlicht not properly resizing on macOS due to incorrect window size; thanks @torleif 2021-03-16 22:12:43 +01:00
a3d848ff8b CMemoryFile: fix seek bounds-checking 2021-03-12 18:28:10 +01:00
57ff34b1ed CGLXManager: Use GLX window correctly
fixes #17
2021-03-12 17:47:00 +01:00
0335a52479 Fix pixel-perfect draw2DLine on OpenGL 2021-03-12 16:30:44 +01:00
4931b34625 Remove trivial copy constructors and operators 2021-03-09 12:47:54 +01:00
cadbd62271 CI: add workflows for win32 and win64 2021-03-08 23:53:47 +01:00
0a09f98c74 macOS: silence OpenGL deprecation warnings 2021-03-08 13:36:44 +01:00
03ad637114 Add README 2021-03-07 13:25:24 +01:00
53e09519e2 Prepare for integration with Minetest 2021-03-07 12:24:37 +01:00
97631c39fe Android: import back button patch 2021-03-07 02:09:32 +01:00
dfe077134d Android: import touchedCount patch 2021-03-07 02:05:10 +01:00
10a188e967 Restore Android support 2021-03-07 01:08:58 +01:00
bfba19d67a Restore Windows and OSX support 2021-03-06 22:39:35 +01:00
752401a450 Remove other left-over build systems 2021-03-06 21:40:05 +01:00
6ce98dce77 Add CMake as new build system 2021-03-06 21:40:05 +01:00
e3decfa3be Fix inconsistent-missing-override warnings 2021-03-06 14:01:22 +01:00
94aafaef15 Fix Windows, Android build 2021-02-25 21:17:36 +01:00
218cbec94e Add GLES workflow to CI 2021-02-25 19:32:19 +01:00
32a45f8239 irrTypes.h: use standard header for number types 2021-02-25 19:09:48 +01:00
c4503eaf17 GLX window is *not* an X11 window 2021-02-25 19:07:58 +01:00
264f8b72c1 Throw out support for Bzip, LZMA and encrypted ZIPs 2021-02-25 18:34:17 +01:00
67f1402410 Remove bundled libraries 2021-02-25 18:22:38 +01:00
665e4309c4 Add github workflow & gitignore 2021-02-25 18:01:55 +01:00
430 changed files with 5007 additions and 247568 deletions

86
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,86 @@
name: build
# build on c/cpp changes or workflow changes
on:
- push
- pull_request
jobs:
linux-gl:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
sudo apt-get install g++ cmake libxxf86vm-dev libgl1-mesa-dev libpng-dev libjpeg-dev zlib1g-dev -qyy
- name: Build
run: |
cmake .
make VERBOSE=1 -j2
- name: Package
run: |
make DESTDIR=$PWD/_install install
tar -c -I "gzip -9" -f irrlicht-linux.tar.gz -C ./_install/usr/local .
- uses: actions/upload-artifact@v2
with:
name: irrlicht-linux
path: ./irrlicht-linux.tar.gz
linux-gles:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
sudo apt-get install g++ cmake libxxf86vm-dev libgles2-mesa-dev libpng-dev libjpeg-dev zlib1g-dev xvfb -qyy
- name: Build
run: |
sed '/#define _IRR_COMPILE_WITH_OGLES2_/ s|^//||g' -i include/IrrCompileConfig.h
sed '/#define _IRR_COMPILE_WITH_OPENGL_/ s|^|//|g' -i include/IrrCompileConfig.h
cmake . -DBUILD_EXAMPLES=1
make -j2
- name: Test (headless)
run: |
cd bin/Linux
./AutomatedTest null
- name: Test (Xvfb)
run: |
cd bin/Linux
LIBGL_ALWAYS_SOFTWARE=true xvfb-run ./AutomatedTest
win32:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
sudo apt-get install cmake g++-mingw-w64-i686 -qyy
- name: Build
run: |
./scripts/ci-build-mingw.sh
env:
CC: i686-w64-mingw32-gcc
CXX: i686-w64-mingw32-g++
win64:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
sudo apt-get install cmake g++-mingw-w64-x86-64 -qyy
- name: Build
run: |
./scripts/ci-build-mingw.sh
env:
CC: x86_64-w64-mingw32-gcc
CXX: x86_64-w64-mingw32-g++

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
CMakeFiles
CMakeCache.txt
cmake_install.cmake
Makefile
*.so*
*.a
*.exe
bin/Linux

67
CMakeLists.txt Normal file
View File

@ -0,0 +1,67 @@
cmake_minimum_required(VERSION 3.5)
project(Irrlicht
VERSION 1.9.0
LANGUAGES CXX
)
message(STATUS "*** Building IrrlichtMt ${PROJECT_VERSION} ***")
include(GNUInstallDirs)
if(ANDROID)
set(sysname Android)
elseif(APPLE)
set(sysname OSX)
elseif(MSVC)
set(sysname Win32-VisualStudio)
elseif(WIN32)
set(sysname Win32-gcc)
else()
set(sysname Linux)
endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/${sysname})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/${sysname})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
add_subdirectory(source/Irrlicht)
option(BUILD_EXAMPLES "Build example applications" FALSE)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# Installation of headers.
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/irrlichtmt"
)
# Installation of CMake target and configuration files.
install(EXPORT IrrlichtMt-export
FILE IrrlichtMtTargets.cmake
NAMESPACE IrrlichtMt::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
)
include(CMakePackageConfigHelpers)
configure_package_config_file("${PROJECT_SOURCE_DIR}/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/IrrlichtMtConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/IrrlichtMtConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/IrrlichtMtConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/IrrlichtMtConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
)

5
Config.cmake.in Normal file
View File

@ -0,0 +1,5 @@
@PACKAGE_INIT@
if(NOT TARGET IrrlichtMt::IrrlichtMt)
include("${CMAKE_CURRENT_LIST_DIR}/IrrlichtMtTargets.cmake")
endif()

65
README.md Normal file
View File

@ -0,0 +1,65 @@
IrrlichtMt version 1.9
======================
The Irrlicht Engine is an open source realtime 3D engine written in C++.
This is a fork by the [Minetest](https://github.com/minetest) developers that contains features, customizations and fixes specifically for use in Minetest.
Build
-----
The build system is CMake.
The following libraries are required to be installed:
* zlib, libPNG, libJPEG
* OpenGL
* or on mobile: OpenGL ES (can be optionally enabled on desktop too)
* on Unix: X11
Aside from standard search options (`ZLIB_INCLUDE_DIR`, `ZLIB_LIBRARY`, ...) the following options are available:
* `BUILD_SHARED_LIBS` (default: `ON`) - Build IrrlichtMt as a shared library
* `BUILD_EXAMPLES` (default: `OFF`) - Build example applications
e.g. on a Linux system you might want to build for local use like this:
git clone https://github.com/minetest/irrlicht
cd irrlicht
cmake . -DBUILD_SHARED_LIBS=OFF
make -j$(nproc)
Platforms
---------
We aim to support these platforms:
* Windows via MinGW
* Linux (GL or GLES)
* macOS
* Android
This doesn't mean other platforms don't work or won't be supported, if you find something that doesn't work contributions are welcome.
License
-------
The license of the Irrlicht Engine is based on the zlib/libpng license and applies to this fork, too.
The Irrlicht Engine License
===========================
Copyright (C) 2002-2012 Nikolaus Gebhardt
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgement in the product documentation would be
appreciated but is not required.
2. Altered source versions must be clearly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

38
cmake/FindOpenGLES2.cmake Normal file
View File

@ -0,0 +1,38 @@
#-------------------------------------------------------------------
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
# Try to find OpenGL ES 2 and EGL
if(WIN32)
find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h)
find_library(OPENGLES2_LIBRARY libGLESv2)
elseif(APPLE)
find_library(OPENGLES2_LIBRARY OpenGLES REQUIRED) # framework
else()
# Unix
find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
PATHS /usr/X11R6/include /usr/include
)
find_library(OPENGLES2_LIBRARY
NAMES GLESv2
PATHS /usr/X11R6/lib /usr/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenGLES2 DEFAULT_MSG OPENGLES2_LIBRARY OPENGLES2_INCLUDE_DIR)
find_path(EGL_INCLUDE_DIR EGL/egl.h
PATHS /usr/X11R6/include /usr/include
)
find_library(EGL_LIBRARY
NAMES EGL
PATHS /usr/X11R6/lib /usr/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EGL REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR NAME_MISMATCHED)
endif()
set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${EGL_LIBRARY})

View File

@ -0,0 +1,112 @@
#include <irrlicht.h>
#include "exampleHelper.h"
using namespace irr;
static video::E_DRIVER_TYPE chooseDriver(const char *arg_)
{
if (core::stringc(arg_) == "null")
return video::EDT_NULL;
if (IrrlichtDevice::isDriverSupported(video::EDT_OGLES1))
return video::EDT_OGLES1;
if (IrrlichtDevice::isDriverSupported(video::EDT_OGLES2))
return video::EDT_OGLES2;
return video::EDT_OPENGL;
}
int main(int argc, char *argv[])
{
SIrrlichtCreationParameters p;
p.DriverType = chooseDriver(argc > 1 ? argv[1] : "");
p.WindowSize = core::dimension2du(640, 480);
p.Vsync = true;
p.LoggingLevel = ELL_DEBUG;
IrrlichtDevice *device = createDeviceEx(p);
if (!device)
return 1;
device->setWindowCaption(L"Hello World!");
device->setResizable(true);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->addStaticText(L"sample text", core::rect<s32>(10,10,110,22), false);
gui::IGUIButton* button = guienv->addButton(
core::rect<s32>(10,30,110,30 + 32), 0, -1, L"sample button",
L"sample tooltip");
gui::IGUIEditBox* editbox = guienv->addEditBox(L"",
core::rect<s32>(10,70,60,70 + 16));
const io::path mediaPath = getExampleMediaPath();
scene::IAnimatedMesh* mesh = smgr->getMesh(mediaPath + "sydney.md2");
if (!mesh)
return 1;
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
if (node)
{
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_STAND);
node->setMaterialTexture(0, driver->getTexture(mediaPath + "sydney.bmp"));
}
smgr->addCameraSceneNode(0, core::vector3df(0,30,-40), core::vector3df(0,5,0));
s32 n = 0;
SEvent event;
device->getTimer()->start();
while (device->run())
{
if (device->getTimer()->getTime() >= 1300)
{
device->getTimer()->setTime(0);
++n;
if (n == 1) // Tooltip display
{
bzero(&event, sizeof(SEvent));
event.EventType = irr::EET_MOUSE_INPUT_EVENT;
event.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
event.MouseInput.X = button->getAbsolutePosition().getCenter().X;
event.MouseInput.Y = button->getAbsolutePosition().getCenter().Y;
device->postEventFromUser(event);
}
else if (n == 2) // Text input focus
guienv->setFocus(editbox);
else if (n == 3) // Keypress for Text input
{
bzero(&event, sizeof(SEvent));
event.EventType = irr::EET_KEY_INPUT_EVENT;
event.KeyInput.Char = L'a';
event.KeyInput.Key = KEY_KEY_A;
event.KeyInput.PressedDown = true;
device->postEventFromUser(event);
event.KeyInput.PressedDown = false;
device->postEventFromUser(event);
}
else
device->closeDevice();
}
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH,
video::SColor(255,100,100,150));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
if (core::stringw(L"a") != editbox->getText()) {
device->getLogger()->log("EditBox text mismatch", ELL_INFORMATION);
return 1;
}
device->getLogger()->log("Done.", ELL_INFORMATION);
device->drop();
return 0;
}

48
examples/CMakeLists.txt Normal file
View File

@ -0,0 +1,48 @@
set(IRREXAMPLES
01.HelloWorld
02.Quake3Map
03.CustomSceneNode
04.Movement
05.UserInterface
06.2DGraphics
07.Collision
08.SpecialFX
09.Meshviewer
10.Shaders
11.PerPixelLighting
12.TerrainRendering
13.RenderToTexture
15.LoadIrrFile
16.Quake3MapShader
18.SplitScreen
19.MouseAndJoystick
20.ManagedLights
21.Quake3Explorer
22.MaterialViewer
23.SMeshHandling
24.CursorControl
25.XmlHandling
26.OcclusionQuery
27.PostProcessing
28.CubeMapping
30.Profiling
)
if(WIN32)
list(APPEND IRREXAMPLES 14.Win32Window)
endif()
if(UNIX)
list(APPEND IRREXAMPLES AutomatedTest)
endif()
foreach(exname IN ITEMS ${IRREXAMPLES})
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/${exname}/*.cpp")
add_executable(${exname} ${sources})
target_include_directories(${exname} PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/${exname}
)
target_link_libraries(${exname} IrrlichtMt)
endforeach()

View File

@ -1,8 +0,0 @@
DIRS = $(wildcard [0123]* Demo)
all: $(DIRS)
$(DIRS):
-@cd $@ && make clean && make
.PHONY: $(DIRS)

View File

@ -156,12 +156,6 @@ namespace scene
position.X = 0.f;
}
// construct copy constructor
SMD3QuaternionTag( const SMD3QuaternionTag & copyMe )
{
*this = copyMe;
}
// construct for searching
SMD3QuaternionTag( const core::stringc& name )
: Name ( name ) {}
@ -181,14 +175,6 @@ namespace scene
return Name == other.Name;
}
SMD3QuaternionTag & operator=( const SMD3QuaternionTag & copyMe )
{
Name = copyMe.Name;
position = copyMe.position;
rotation = copyMe.rotation;
return *this;
}
core::stringc Name;
core::vector3df position;
core::quaternion rotation;
@ -202,12 +188,6 @@ namespace scene
Container.setAllocStrategy(core::ALLOC_STRATEGY_SAFE);
}
// construct copy constructor
SMD3QuaternionTagList(const SMD3QuaternionTagList& copyMe)
{
*this = copyMe;
}
virtual ~SMD3QuaternionTagList() {}
SMD3QuaternionTag* get(const core::stringc& name)
@ -250,12 +230,6 @@ namespace scene
Container.push_back(other);
}
SMD3QuaternionTagList& operator = (const SMD3QuaternionTagList & copyMe)
{
Container = copyMe.Container;
return *this;
}
private:
core::array < SMD3QuaternionTag > Container;
};

View File

@ -74,13 +74,13 @@ namespace scene
virtual E_BONE_ANIMATION_MODE getAnimationMode() const = 0;
//! Get the axis aligned bounding box of this node
virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
virtual const core::aabbox3d<f32>& getBoundingBox() const _IRR_OVERRIDE_ = 0;
//! Returns the relative transformation of the scene node.
//virtual core::matrix4 getRelativeTransformation() const = 0;
//! The animation method.
virtual void OnAnimate(u32 timeMs) =0;
virtual void OnAnimate(u32 timeMs) _IRR_OVERRIDE_ =0;
//! The render method.
/** Does nothing as bones are not visible. */

View File

@ -72,7 +72,7 @@ namespace scene
ISceneManager::addCameraSceneNodeFPS, may want to get
this input for changing their position, look at target or
whatever. */
virtual bool OnEvent(const SEvent& event) =0;
virtual bool OnEvent(const SEvent& event) _IRR_OVERRIDE_ =0;
//! Sets the look at target of the camera
/** If the camera's target and rotation are bound ( @see
@ -90,7 +90,7 @@ namespace scene
bindTargetAndRotation() ) then calling this will also change
the camera's target to match the rotation.
\param rotation New rotation of the node in degrees. */
virtual void setRotation(const core::vector3df& rotation) =0;
virtual void setRotation(const core::vector3df& rotation) _IRR_OVERRIDE_ =0;
//! Gets the current look at target of the camera
/** \return The current look at target of the camera, in world co-ordinates */

View File

@ -34,6 +34,10 @@ namespace irr
IrrlichtDevice::postEventFromUser. They take the same path as mouse events. */
EET_KEY_INPUT_EVENT,
//! A string input event.
/** This event is created when multiple characters are sent at a time (e.g. using an IME). */
EET_STRING_INPUT_EVENT,
//! A touch input event.
EET_TOUCH_INPUT_EVENT,
@ -413,6 +417,13 @@ struct SEvent
bool Control:1;
};
//! String input event.
struct SStringInput
{
//! The string that is entered
core::stringw *Str;
};
//! Any kind of touch event.
struct STouchInput
{
@ -425,6 +436,9 @@ struct SEvent
// Y position of simple touch.
s32 Y;
// number of current touches
s32 touchedCount;
//! Type of touch event.
ETOUCH_INPUT_EVENT Event;
};
@ -578,6 +592,7 @@ struct SEvent
struct SGUIEvent GUIEvent;
struct SMouseInput MouseInput;
struct SKeyInput KeyInput;
struct SStringInput StringInput;
struct STouchInput TouchInput;
struct SAccelerometerEvent AccelerometerEvent;
struct SGyroscopeEvent GyroscopeEvent;

View File

@ -789,6 +789,13 @@ public:
}
//! Returns whether the element takes input from the IME
virtual bool acceptsIME()
{
return false;
}
//! Writes attributes of the scene node.
/** Implement this to expose the attributes of your scene node for
scripting languages, editors, debuggers or xml serialization purposes. */

View File

@ -36,7 +36,7 @@ public:
kerning value. For example, EGFT_BITMAP will add the right kerning value of previousLetter to the
left side kerning value of thisLetter, then add the global value.
*/
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const = 0;
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const _IRR_OVERRIDE_ = 0;
};
} // end namespace gui

View File

@ -639,13 +639,6 @@ namespace quake3
: ID ( 0 ), VarGroup ( 0 ) {}
virtual ~IShader () {}
void operator = (const IShader &other )
{
ID = other.ID;
VarGroup = other.VarGroup;
name = other.name;
}
bool operator == (const IShader &other ) const
{
return 0 == strcmp ( name.c_str(), other.name.c_str () );

View File

@ -532,7 +532,8 @@ namespace video
possible to render into a texture between the
IVideoDriver::beginScene() and endScene() method calls. If you need the
best performance use this method instead of setRenderTarget.
\param target Render target object.
\param target Render target object. If set to nullptr, it makes the
window the current render target.
\param clearFlag A combination of the E_CLEAR_BUFFER_FLAG bit-flags.
\param clearColor The clear color for the color buffer.
\param clearDepth The clear value for the depth buffer.
@ -562,9 +563,8 @@ namespace video
possible to render into a texture between the
IVideoDriver::beginScene() and endScene() method calls.
\param texture New render target. Must be a texture created with
IVideoDriver::addRenderTargetTexture(). If set to 0, it sets
the previous render target which was set before the last
setRenderTarget() call.
IVideoDriver::addRenderTargetTexture(). If set to nullptr, it makes
the window the current render target.
\param clearFlag A combination of the E_CLEAR_BUFFER_FLAG bit-flags.
\param clearColor The clear color for the color buffer.
\param clearDepth The clear value for the depth buffer.
@ -923,8 +923,8 @@ namespace video
//! Draws a 2d line.
/** In theory both start and end will be included in coloring.
BUG: Currently hardware drivers (d3d/opengl) ignore the last pixel
(they use the so called "diamond exit rule" for drawing lines).
BUG: Currently d3d ignores the last pixel
(it uses the so called "diamond exit rule" for drawing lines).
\param start Screen coordinates of the start of the line
in pixels.
\param end Screen coordinates of the start of the line in

View File

@ -5,6 +5,10 @@
#ifndef __IRR_COMPILE_CONFIG_H_INCLUDED__
#define __IRR_COMPILE_CONFIG_H_INCLUDED__
//! Identifies Irrlicht fork customized for the Minetest engine
#define IRRLICHT_VERSION_MT_REVISION 2
#define IRRLICHT_VERSION_MT "mt2"
//! Irrlicht SDK Version
#define IRRLICHT_VERSION_MAJOR 1
#define IRRLICHT_VERSION_MINOR 9
@ -12,7 +16,7 @@
// This flag will be defined only in SVN, the official release code will have
// it undefined
#define IRRLICHT_VERSION_SVN alpha
#define IRRLICHT_SDK_VERSION "1.9.0"
#define IRRLICHT_SDK_VERSION "1.9.0" IRRLICHT_VERSION_MT
#include <stdio.h> // TODO: Although included elsewhere this is required at least for mingw
@ -112,8 +116,6 @@
#define _IRR_COMPILE_WITH_SDL_DEVICE_
#define NO_IRR_COMPILE_WITH_X11_DEVICE_
#define _IRR_LINUX_PLATFORM_ // emscripten basically working like a unix
#define NO_IRR_COMPILE_WITH_SOFTWARE_
#define NO_IRR_COMPILE_WITH_BURNINGSVIDEO_
#endif // __EMSCRIPTEN__
#if defined(__ANDROID__)
@ -180,7 +182,7 @@ _IRR_COMPILE_WITH_DX9_DEV_PACK_. So you simply need to add something like this
to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK
and this to the linker settings: -ld3dx9
*/
#if defined(_IRR_WINDOWS_API_) && (!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK))
#if defined(_IRR_WINDOWS_API_) && defined(IRR_COMPILE_WITH_DX9_DEV_PACK)
//! Define _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ if you want to use DirectInput for joystick handling.
/** This only applies to Windows devices, currently only supported under Win32 device.
@ -261,14 +263,18 @@ Depending on platform you may have to enable _IRR_OGLES1_USE_KHRONOS_API_HEADERS
//! Define _IRR_COMPILE_WITH_OGLES2_ to compile the Irrlicht engine with OpenGL ES 2.0.
/** If you do not wish the engine to be compiled with OpenGL ES 2.0, comment this
define out. */
#if defined(_IRR_ANDROID_PLATFORM_) || defined(_IRR_IOS_PLATFORM_)
#define _IRR_COMPILE_WITH_OGLES2_
#else
//#define _IRR_COMPILE_WITH_OGLES2_
#endif
#ifdef NO_IRR_COMPILE_WITH_OGLES2_
#undef _IRR_COMPILE_WITH_OGLES2_
#endif
//! Define _IRR_COMPILE_WITH_WEBGL1_ to compile Irrlicht engine with a WebGL friendly
//! subset of the OpenGL ES 2.0 driver.
#define _IRR_COMPILE_WITH_WEBGL1_
//#define _IRR_COMPILE_WITH_WEBGL1_
#ifdef NO_IRR_COMPILE_WITH_WEBGL1_
#undef _IRR_COMPILE_WITH_WEBGL1_
#endif
@ -295,14 +301,14 @@ define out. */
//! Define _IRR_COMPILE_WITH_SOFTWARE_ to compile the Irrlicht engine with software driver
/** If you do not need the software driver, or want to use Burning's Video instead,
comment this define out */
#define _IRR_COMPILE_WITH_SOFTWARE_
//#define _IRR_COMPILE_WITH_SOFTWARE_
#ifdef NO_IRR_COMPILE_WITH_SOFTWARE_
#undef _IRR_COMPILE_WITH_SOFTWARE_
#endif
//! Define _IRR_COMPILE_WITH_BURNINGSVIDEO_ to compile the Irrlicht engine with Burning's video driver
/** If you do not need this software driver, you can comment this define out. */
#define _IRR_COMPILE_WITH_BURNINGSVIDEO_
//#define _IRR_COMPILE_WITH_BURNINGSVIDEO_
#ifdef NO_IRR_COMPILE_WITH_BURNINGSVIDEO_
#undef _IRR_COMPILE_WITH_BURNINGSVIDEO_
#endif
@ -376,16 +382,6 @@ the engine will no longer read .jpeg images. */
#undef _IRR_COMPILE_WITH_LIBJPEG_
#endif
//! Define _IRR_USE_NON_SYSTEM_JPEG_LIB_ to let irrlicht use the jpeglib which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the jpeg lib installed in the system.
This is only used when _IRR_COMPILE_WITH_LIBJPEG_ is defined.
NOTE: You will also have to modify the Makefile or project files when changing this default.
*/
#define _IRR_USE_NON_SYSTEM_JPEG_LIB_
#ifdef NO_IRR_USE_NON_SYSTEM_JPEG_LIB_
#undef _IRR_USE_NON_SYSTEM_JPEG_LIB_
#endif
//! Define _IRR_COMPILE_WITH_LIBPNG_ to enable compiling the engine using libpng.
/** This enables the engine to read png images. If you comment this out,
the engine will no longer read .png images. */
@ -394,16 +390,6 @@ the engine will no longer read .png images. */
#undef _IRR_COMPILE_WITH_LIBPNG_
#endif
//! Define _IRR_USE_NON_SYSTEM_LIBPNG_ to let irrlicht use the libpng which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the libpng installed in the system.
This is only used when _IRR_COMPILE_WITH_LIBPNG_ is defined.
NOTE: You will also have to modify the Makefile or project files when changing this default.
*/
#define _IRR_USE_NON_SYSTEM_LIB_PNG_
#ifdef NO_IRR_USE_NON_SYSTEM_LIB_PNG_
#undef _IRR_USE_NON_SYSTEM_LIB_PNG_
#endif
//! Define _IRR_D3D_NO_SHADER_DEBUGGING to disable shader debugging in D3D9
/** If _IRR_D3D_NO_SHADER_DEBUGGING is undefined in IrrCompileConfig.h,
it is possible to debug all D3D9 shaders in VisualStudio. All shaders
@ -791,46 +777,6 @@ ones. */
#ifdef NO_IRR_COMPILE_WITH_ZLIB_
#undef _IRR_COMPILE_WITH_ZLIB_
#endif
//! Define _IRR_USE_NON_SYSTEM_ZLIB_ to let irrlicht use the zlib which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the zlib
installed on the system. This is only used when _IRR_COMPILE_WITH_ZLIB_ is
defined.
NOTE: You will also have to modify the Makefile or project files when changing this default.
*/
#define _IRR_USE_NON_SYSTEM_ZLIB_
#ifdef NO_IRR_USE_NON_SYSTEM_ZLIB_
#undef _IRR_USE_NON_SYSTEM_ZLIB_
#endif
//! Define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_ if you want to read AES-encrypted ZIP archives
#define _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
#ifdef NO_IRR_COMPILE_WITH_ZIP_ENCRYPTION_
#undef _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
#endif
//! Define _IRR_COMPILE_WITH_BZIP2_ if you want to support bzip2 compressed zip archives
/** bzip2 is superior to the original zip file compression modes, but requires
a certain amount of memory for decompression and adds several files to the
library. */
#define _IRR_COMPILE_WITH_BZIP2_
#ifdef NO_IRR_COMPILE_WITH_BZIP2_
#undef _IRR_COMPILE_WITH_BZIP2_
#endif
//! Define _IRR_USE_NON_SYSTEM_BZLIB_ to let irrlicht use the bzlib which comes with irrlicht.
/** If this is commented out, Irrlicht will try to compile using the bzlib
installed on the system. This is only used when _IRR_COMPILE_WITH_BZLIB_ is
defined.
NOTE: You will also have to modify the Makefile or project files when changing this default.
*/
#define _IRR_USE_NON_SYSTEM_BZLIB_
#ifdef NO_IRR_USE_NON_SYSTEM_BZLIB_
#undef _IRR_USE_NON_SYSTEM_BZLIB_
#endif
//! Define _IRR_COMPILE_WITH_LZMA_ if you want to use LZMA compressed zip files.
/** LZMA is a very efficient compression code, known from 7zip. Irrlicht
currently only supports zip archives, though. */
#define _IRR_COMPILE_WITH_LZMA_
#ifdef NO_IRR_COMPILE_WITH_LZMA_
#undef _IRR_COMPILE_WITH_LZMA_
#endif
#endif
//! Define __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_ if you want to mount folders as archives

View File

@ -61,6 +61,7 @@ struct SExposedVideoData
void* X11Display;
void* X11Context;
unsigned long X11Window;
unsigned long GLXWindow;
};
struct SOpenGLOSX

View File

@ -328,53 +328,6 @@ namespace video
*this = other;
}
//! Assignment operator
/** \param other Material to copy from. */
SMaterial& operator=(const SMaterial& other)
{
// Check for self-assignment!
if (this == &other)
return *this;
MaterialType = other.MaterialType;
AmbientColor = other.AmbientColor;
DiffuseColor = other.DiffuseColor;
EmissiveColor = other.EmissiveColor;
SpecularColor = other.SpecularColor;
Shininess = other.Shininess;
MaterialTypeParam = other.MaterialTypeParam;
MaterialTypeParam2 = other.MaterialTypeParam2;
Thickness = other.Thickness;
for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)
{
TextureLayer[i] = other.TextureLayer[i];
}
Wireframe = other.Wireframe;
PointCloud = other.PointCloud;
GouraudShading = other.GouraudShading;
Lighting = other.Lighting;
ZWriteEnable = other.ZWriteEnable;
BackfaceCulling = other.BackfaceCulling;
FrontfaceCulling = other.FrontfaceCulling;
FogEnable = other.FogEnable;
NormalizeNormals = other.NormalizeNormals;
ZBuffer = other.ZBuffer;
AntiAliasing = other.AntiAliasing;
ColorMask = other.ColorMask;
ColorMaterial = other.ColorMaterial;
BlendOperation = other.BlendOperation;
BlendFactor = other.BlendFactor;
PolygonOffsetFactor = other.PolygonOffsetFactor;
PolygonOffsetDirection = other.PolygonOffsetDirection;
PolygonOffsetDepthBias = other.PolygonOffsetDepthBias;
PolygonOffsetSlopeScale = other.PolygonOffsetSlopeScale;
UseMipMaps = other.UseMipMaps;
return *this;
}
//! Texture layer array.
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];

View File

@ -140,9 +140,6 @@ class map
reset();
}
// Copy constructor
Iterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
void reset(bool atLowest=true)
{
if (atLowest)
@ -161,13 +158,6 @@ class map
return Cur;
}
Iterator& operator=(const Iterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int)
{
inc();
@ -287,8 +277,7 @@ class map
reset();
}
// Copy constructor
ConstIterator(const ConstIterator& src) : Root(src.Root), Cur(src.Cur) {}
// Constructor(Iterator)
ConstIterator(const Iterator& src) : Root(src.Root), Cur(src.Cur) {}
void reset(bool atLowest=true)
@ -309,13 +298,6 @@ class map
return Cur;
}
ConstIterator& operator=(const ConstIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int)
{
inc();
@ -453,13 +435,6 @@ class map
return Cur;
}
ParentFirstIterator& operator=(const ParentFirstIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int)
{
inc();
@ -552,13 +527,6 @@ class map
return Cur;
}
ParentLastIterator& operator=(const ParentLastIterator& src)
{
Root = src.Root;
Cur = src.Cur;
return (*this);
}
void operator++(int)
{
inc();

View File

@ -6,29 +6,16 @@
#define __IRR_TYPES_H_INCLUDED__
#include "IrrCompileConfig.h"
#if defined(__GNUC__)
#include <limits.h> // for __WORDSIZE
#endif
#include <stdint.h>
namespace irr
{
//! 8 bit unsigned variable.
/** This is a typedef for unsigned char, it ensures portability of the engine. */
#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef unsigned __int8 u8;
#else
typedef unsigned char u8;
#endif
typedef uint8_t u8;
//! 8 bit signed variable.
/** This is a typedef for signed char, it ensures portability of the engine. */
#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef __int8 s8;
#else
typedef signed char s8;
#endif
typedef int8_t s8;
//! 8 bit character variable.
/** This is a typedef for char, it ensures portability of the engine. */
@ -37,68 +24,26 @@ typedef char c8;
//! 16 bit unsigned variable.
/** This is a typedef for unsigned short, it ensures portability of the engine. */
#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef unsigned __int16 u16;
#else
typedef unsigned short u16;
#endif
typedef uint16_t u16;
//! 16 bit signed variable.
/** This is a typedef for signed short, it ensures portability of the engine. */
#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef __int16 s16;
#else
typedef signed short s16;
#endif
typedef int16_t s16;
//! 32 bit unsigned variable.
/** This is a typedef for unsigned int, it ensures portability of the engine. */
#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef unsigned __int32 u32;
#else
typedef unsigned int u32;
#endif
typedef uint32_t u32;
//! 32 bit signed variable.
/** This is a typedef for signed int, it ensures portability of the engine. */
#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef __int32 s32;
#else
typedef signed int s32;
#endif
typedef int32_t s32;
#ifdef __IRR_HAS_S64
//! 64 bit unsigned variable.
/** This is a typedef for 64bit uint, it ensures portability of the engine. */
#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef unsigned __int64 u64;
#elif defined(__GNUC__)
#if defined(__WORDSIZE) && __WORDSIZE == 64
typedef unsigned long int u64;
#else
__extension__ typedef unsigned long long u64;
#endif
#else
typedef unsigned long long u64;
#endif
typedef uint64_t u64;
//! 64 bit signed variable.
/** This is a typedef for 64bit int, it ensures portability of the engine. */
#if defined(_MSC_VER) || ((__BORLANDC__ >= 0x530) && !defined(__STRICT_ANSI__))
typedef __int64 s64;
#elif defined(__GNUC__)
#if defined(__WORDSIZE) && __WORDSIZE == 64
typedef long int s64;
#else
__extension__ typedef long long s64;
#endif
#else
typedef long long s64;
#endif
typedef int64_t s64;
#endif // __IRR_HAS_S64

3709
include/irrUString.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,6 @@ class line2d
line2d(T xa, T ya, T xb, T yb) : start(xa, ya), end(xb, yb) {}
//! Constructor for line between the two points given as vectors.
line2d(const vector2d<T>& start, const vector2d<T>& end) : start(start), end(end) {}
//! Copy constructor.
line2d(const line2d<T>& other) : start(other.start), end(other.end) {}
// operators

View File

@ -102,9 +102,6 @@ namespace core
//! Simple operator for linearly accessing every element of the matrix.
const T& operator[](u32 index) const { return M[index]; }
//! Sets this matrix equal to the other matrix.
inline CMatrix4<T>& operator=(const CMatrix4<T> &other);
//! Sets all elements of this matrix to the value.
inline CMatrix4<T>& operator=(const T& scalar);
@ -1504,19 +1501,6 @@ namespace core
}
template <class T>
inline CMatrix4<T>& CMatrix4<T>::operator=(const CMatrix4<T> &other)
{
if (this==&other)
return *this;
memcpy(M, other.M, 16*sizeof(T));
#if defined ( USE_MATRIX_TEST )
definitelyIdentityMatrix=other.definitelyIdentityMatrix;
#endif
return *this;
}
template <class T>
inline CMatrix4<T>& CMatrix4<T>::operator=(const T& scalar)
{

View File

@ -55,9 +55,6 @@ class quaternion
//! inequality operator
bool operator!=(const quaternion& other) const;
//! Assignment operator
inline quaternion& operator=(const quaternion& other);
#ifndef IRR_TEST_BROKEN_QUATERNION_USE
//! Matrix assignment operator
inline quaternion& operator=(const matrix4& other);
@ -240,16 +237,6 @@ inline bool quaternion::operator!=(const quaternion& other) const
return !(*this == other);
}
// assignment operator
inline quaternion& quaternion::operator=(const quaternion& other)
{
X = other.X;
Y = other.Y;
Z = other.Z;
W = other.W;
return *this;
}
#ifndef IRR_TEST_BROKEN_QUATERNION_USE
// matrix assignment operator
inline quaternion& quaternion::operator=(const matrix4& m)

View File

@ -27,8 +27,6 @@ public:
vector2d(T nx, T ny) : X(nx), Y(ny) {}
//! Constructor with the same value for both members
explicit vector2d(T n) : X(n), Y(n) {}
//! Copy constructor
vector2d(const vector2d<T>& other) : X(other.X), Y(other.Y) {}
vector2d(const dimension2d<T>& other) : X(other.Width), Y(other.Height) {}
@ -36,8 +34,6 @@ public:
vector2d<T> operator-() const { return vector2d<T>(-X, -Y); }
vector2d<T>& operator=(const vector2d<T>& other) { X = other.X; Y = other.Y; return *this; }
vector2d<T>& operator=(const dimension2d<T>& other) { X = other.Width; Y = other.Height; return *this; }
vector2d<T> operator+(const vector2d<T>& other) const { return vector2d<T>(X + other.X, Y + other.Y); }

View File

@ -28,15 +28,11 @@ namespace core
vector3d(T nx, T ny, T nz) : X(nx), Y(ny), Z(nz) {}
//! Constructor with the same value for all elements
explicit vector3d(T n) : X(n), Y(n), Z(n) {}
//! Copy constructor
vector3d(const vector3d<T>& other) : X(other.X), Y(other.Y), Z(other.Z) {}
// operators
vector3d<T> operator-() const { return vector3d<T>(-X, -Y, -Z); }
vector3d<T>& operator=(const vector3d<T>& other) { X = other.X; Y = other.Y; Z = other.Z; return *this; }
vector3d<T> operator+(const vector3d<T>& other) const { return vector3d<T>(X + other.X, Y + other.Y, Z + other.Z); }
vector3d<T>& operator+=(const vector3d<T>& other) { X+=other.X; Y+=other.Y; Z+=other.Z; return *this; }
vector3d<T> operator+(const T val) const { return vector3d<T>(X + val, Y + val, Z + val); }

36
scripts/ci-build-mingw.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash -e
[[ -z "$CC" || -z "$CXX" ]] && exit 255
variant=win32
[[ "$CXX" == "x86_64-"* ]] && variant=win64
libjpeg_version=2.0.6
libpng_version=1.6.37
zlib_version=1.2.11
mkdir -p libs
pushd libs
libs=$PWD
[ -e libjpeg.zip ] || \
wget "http://minetest.kitsunemimi.pw/libjpeg-$libjpeg_version-$variant.zip" -O libjpeg.zip
[ -e libpng.zip ] || \
wget "http://minetest.kitsunemimi.pw/libpng-$libpng_version-$variant.zip" -O libpng.zip
[ -e zlib.zip ] || \
wget "http://minetest.kitsunemimi.pw/zlib-$zlib_version-$variant.zip" -O zlib.zip
[ -d libjpeg ] || unzip -o libjpeg.zip -d libjpeg
[ -d libpng ] || unzip -o libpng.zip -d libpng
[ -d zlib ] || unzip -o zlib.zip -d zlib
popd
cmake . \
-DCMAKE_SYSTEM_NAME=Windows \
-DPNG_LIBRARY=$libs/libpng/lib/libpng.dll.a \
-DPNG_PNG_INCLUDE_DIR=$libs/libpng/include \
-DJPEG_LIBRARY=$libs/libjpeg/lib/libjpeg.dll.a \
-DJPEG_INCLUDE_DIR=$libs/libjpeg/include \
-DZLIB_LIBRARY=$libs/zlib/lib/libz.dll.a \
-DZLIB_INCLUDE_DIR=$libs/zlib/include
make -j$(nproc)
exit 0

View File

@ -393,6 +393,7 @@ s32 CIrrDeviceAndroid::handleInput(android_app* app, AInputEvent* androidEvent)
event.TouchInput.ID = AMotionEvent_getPointerId(androidEvent, i);
event.TouchInput.X = AMotionEvent_getX(androidEvent, i);
event.TouchInput.Y = AMotionEvent_getY(androidEvent, i);
event.TouchInput.touchedCount = AMotionEvent_getPointerCount(androidEvent);
device->postEventFromUser(event);
}
@ -404,6 +405,7 @@ s32 CIrrDeviceAndroid::handleInput(android_app* app, AInputEvent* androidEvent)
event.TouchInput.ID = AMotionEvent_getPointerId(androidEvent, pointerIndex);
event.TouchInput.X = AMotionEvent_getX(androidEvent, pointerIndex);
event.TouchInput.Y = AMotionEvent_getY(androidEvent, pointerIndex);
event.TouchInput.touchedCount = AMotionEvent_getPointerCount(androidEvent);
device->postEventFromUser(event);
}
@ -507,7 +509,7 @@ s32 CIrrDeviceAndroid::handleInput(android_app* app, AInputEvent* androidEvent)
event.KeyInput.Char = 0;
}
device->postEventFromUser(event);
status = device->postEventFromUser(event);
}
break;
default:
@ -564,7 +566,7 @@ void CIrrDeviceAndroid::createKeyMap()
KeyMap[1] = KEY_LBUTTON; // AKEYCODE_SOFT_LEFT
KeyMap[2] = KEY_RBUTTON; // AKEYCODE_SOFT_RIGHT
KeyMap[3] = KEY_HOME; // AKEYCODE_HOME
KeyMap[4] = KEY_BACK; // AKEYCODE_BACK
KeyMap[4] = KEY_CANCEL; // AKEYCODE_BACK
KeyMap[5] = KEY_UNKNOWN; // AKEYCODE_CALL
KeyMap[6] = KEY_UNKNOWN; // AKEYCODE_ENDCALL
KeyMap[7] = KEY_KEY_0; // AKEYCODE_0

View File

@ -1,345 +0,0 @@
LOCAL_PATH := $(call my-dir)/../..
IRRLICHT_LIB_PATH := $(LOCAL_PATH)/../../lib/Android
include $(CLEAR_VARS)
LOCAL_MODULE := Irrlicht
IRRLICHT_LIB_NAME := lib$(LOCAL_MODULE).a
LOCAL_CFLAGS := -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing
ifndef NDEBUG
LOCAL_CFLAGS += -g -D_DEBUG
else
LOCAL_CFLAGS += -fexpensive-optimizations -O3
endif
LOCAL_C_INCLUDES := ../../../include
LOCAL_C_INCLUDES += ../zlib ../jpeglib ../libpng
LOCAL_SRC_FILES := \
Android/CIrrDeviceAndroid.cpp \
Android/CAndroidAssetReader.cpp \
Android/CAndroidAssetFileArchive.cpp \
Android/CKeyEventWrapper.cpp \
aesGladman/aescrypt.cpp \
aesGladman/aeskey.cpp \
aesGladman/aestab.cpp \
aesGladman/fileenc.cpp \
aesGladman/hmac.cpp \
aesGladman/prng.cpp \
aesGladman/pwd2key.cpp \
aesGladman/sha1.cpp \
aesGladman/sha2.cpp \
burning_shader_color.cpp \
C3DSMeshFileLoader.cpp \
CAnimatedMeshHalfLife.cpp \
CAnimatedMeshMD2.cpp \
CAnimatedMeshMD3.cpp \
CAnimatedMeshSceneNode.cpp \
CAttributes.cpp \
CB3DMeshFileLoader.cpp \
CB3DMeshWriter.cpp \
CBillboardSceneNode.cpp \
CBoneSceneNode.cpp \
CBSPMeshFileLoader.cpp \
CBurningShader_Raster_Reference.cpp \
CCameraSceneNode.cpp \
CColladaFileLoader.cpp \
CColladaMeshWriter.cpp \
CColorConverter.cpp \
CCSMLoader.cpp \
CCubeSceneNode.cpp \
CD3D9Driver.cpp \
CD3D9HLSLMaterialRenderer.cpp \
CD3D9NormalMapRenderer.cpp \
CD3D9ParallaxMapRenderer.cpp \
CD3D9ShaderMaterialRenderer.cpp \
CD3D9Texture.cpp \
CDefaultGUIElementFactory.cpp \
CDefaultSceneNodeAnimatorFactory.cpp \
CDefaultSceneNodeFactory.cpp \
CDepthBuffer.cpp \
CDMFLoader.cpp \
CDummyTransformationSceneNode.cpp \
CEmptySceneNode.cpp \
CFileList.cpp \
CFileSystem.cpp \
CFPSCounter.cpp \
leakHunter.cpp \
CGeometryCreator.cpp \
CGUIButton.cpp \
CGUICheckBox.cpp \
CGUIColorSelectDialog.cpp \
CGUIComboBox.cpp \
CGUIContextMenu.cpp \
CGUIEditBox.cpp \
CGUIEnvironment.cpp \
CGUIFileOpenDialog.cpp \
CGUIFont.cpp \
CGUIImage.cpp \
CGUIImageList.cpp \
CGUIInOutFader.cpp \
CGUIListBox.cpp \
CGUIMenu.cpp \
CGUIMeshViewer.cpp \
CGUIMessageBox.cpp \
CGUIModalScreen.cpp \
CGUIScrollBar.cpp \
CGUISkin.cpp \
CGUISpinBox.cpp \
CGUISpriteBank.cpp \
CGUIStaticText.cpp \
CGUITabControl.cpp \
CGUITable.cpp \
CGUIToolBar.cpp \
CGUITreeView.cpp \
CGUIWindow.cpp \
CGUIProfiler.cpp \
CImage.cpp \
CImageLoaderBMP.cpp \
CImageLoaderDDS.cpp \
CImageLoaderJPG.cpp \
CImageLoaderPCX.cpp \
CImageLoaderPNG.cpp \
CImageLoaderPPM.cpp \
CImageLoaderPSD.cpp \
CImageLoaderRGB.cpp \
CImageLoaderTGA.cpp \
CImageLoaderWAL.cpp \
CImageWriterBMP.cpp \
CImageWriterJPG.cpp \
CImageWriterPCX.cpp \
CImageWriterPNG.cpp \
CImageWriterPPM.cpp \
CImageWriterPSD.cpp \
CImageWriterTGA.cpp \
CImageLoaderPVR.cpp \
CIrrDeviceConsole.cpp \
CIrrDeviceFB.cpp \
CIrrDeviceLinux.cpp \
CIrrDeviceSDL.cpp \
CIrrDeviceStub.cpp \
CIrrDeviceWin32.cpp \
CIrrMeshFileLoader.cpp \
CIrrMeshWriter.cpp \
CLightSceneNode.cpp \
CLimitReadFile.cpp \
CLMTSMeshFileLoader.cpp \
CLogger.cpp \
CLWOMeshFileLoader.cpp \
CMD2MeshFileLoader.cpp \
CMD3MeshFileLoader.cpp \
CMemoryFile.cpp \
CMeshCache.cpp \
CMeshManipulator.cpp \
CMeshSceneNode.cpp \
CMeshTextureLoader.cpp \
CMetaTriangleSelector.cpp \
CMountPointReader.cpp \
CMS3DMeshFileLoader.cpp \
CMY3DMeshFileLoader.cpp \
CNPKReader.cpp \
CNullDriver.cpp \
COBJMeshFileLoader.cpp \
COBJMeshWriter.cpp \
COCTLoader.cpp \
COctreeSceneNode.cpp \
COctreeTriangleSelector.cpp \
CEGLManager.cpp \
COGLES2Driver.cpp \
COGLES2ExtensionHandler.cpp \
COGLES2MaterialRenderer.cpp \
COGLES2FixedPipelineRenderer.cpp \
COGLES2NormalMapRenderer.cpp \
COGLES2ParallaxMapRenderer.cpp \
COGLES2Renderer2D.cpp \
COGLESDriver.cpp \
COGLESExtensionHandler.cpp \
COgreMeshFileLoader.cpp \
COpenGLCacheHandler.cpp \
COpenGLDriver.cpp \
COpenGLExtensionHandler.cpp \
COpenGLNormalMapRenderer.cpp \
COpenGLParallaxMapRenderer.cpp \
COpenGLShaderMaterialRenderer.cpp \
COpenGLSLMaterialRenderer.cpp \
COSOperator.cpp \
CPakReader.cpp \
CParticleAnimatedMeshSceneNodeEmitter.cpp \
CParticleAttractionAffector.cpp \
CParticleBoxEmitter.cpp \
CParticleCylinderEmitter.cpp \
CParticleFadeOutAffector.cpp \
CParticleGravityAffector.cpp \
CParticleMeshEmitter.cpp \
CParticlePointEmitter.cpp \
CParticleRingEmitter.cpp \
CParticleRotationAffector.cpp \
CParticleScaleAffector.cpp \
CParticleSphereEmitter.cpp \
CParticleSystemSceneNode.cpp \
CPLYMeshFileLoader.cpp \
CPLYMeshWriter.cpp \
CProfiler.cpp \
CQ3LevelMesh.cpp \
CQuake3ShaderSceneNode.cpp \
CReadFile.cpp \
CSceneCollisionManager.cpp \
CSceneLoaderIrr.cpp \
CSceneManager.cpp \
CSceneNodeAnimatorCameraFPS.cpp \
CSceneNodeAnimatorCameraMaya.cpp \
CSceneNodeAnimatorCollisionResponse.cpp \
CSceneNodeAnimatorDelete.cpp \
CSceneNodeAnimatorFlyCircle.cpp \
CSceneNodeAnimatorFlyStraight.cpp \
CSceneNodeAnimatorFollowSpline.cpp \
CSceneNodeAnimatorRotation.cpp \
CSceneNodeAnimatorTexture.cpp \
CShadowVolumeSceneNode.cpp \
CSkinnedMesh.cpp \
CSkyBoxSceneNode.cpp \
CSkyDomeSceneNode.cpp \
CSMFMeshFileLoader.cpp \
CSoftwareDriver.cpp \
CSoftwareDriver2.cpp \
CSoftwareTexture.cpp \
CSoftwareTexture2.cpp \
CSphereSceneNode.cpp \
CSTLMeshFileLoader.cpp \
CSTLMeshWriter.cpp \
CTarReader.cpp \
CTerrainSceneNode.cpp \
CTerrainTriangleSelector.cpp \
CTextSceneNode.cpp \
CTRFlat.cpp \
CTRFlatWire.cpp \
CTRGouraud.cpp \
CTRGouraud2.cpp \
CTRGouraudAlpha2.cpp \
CTRGouraudAlphaNoZ2.cpp \
CTRGouraudWire.cpp \
CTriangleBBSelector.cpp \
CTriangleSelector.cpp \
CTRGouraudNoZ2.cpp \
CTRNormalMap.cpp \
CTRStencilShadow.cpp \
CTRTextureBlend.cpp \
CTRTextureDetailMap2.cpp \
CTRTextureFlat.cpp \
CTRTextureFlatWire.cpp \
CTRTextureGouraud.cpp \
CTRTextureGouraud2.cpp \
CTRTextureGouraudAdd.cpp \
CTRTextureGouraudAdd2.cpp \
CTRTextureGouraudAddNoZ2.cpp \
CTRTextureGouraudAlpha.cpp \
CTRTextureGouraudAlphaNoZ.cpp \
CTRTextureGouraudNoZ.cpp \
CTRTextureGouraudNoZ2.cpp \
CTRTextureGouraudVertexAlpha2.cpp \
CTRTextureGouraudWire.cpp \
CTRTextureLightMap2_Add.cpp \
CTRTextureLightMap2_M1.cpp \
CTRTextureLightMap2_M2.cpp \
CTRTextureLightMap2_M4.cpp \
CTRTextureLightMapGouraud2_M4.cpp \
CTRTextureWire2.cpp \
CTR_transparent_reflection_2_layer.cpp \
CVideoModeList.cpp \
CVolumeLightSceneNode.cpp \
CWADReader.cpp \
CWaterSurfaceSceneNode.cpp \
CWriteFile.cpp \
CXMeshFileLoader.cpp \
CXMLReader.cpp \
CXMLWriter.cpp \
CZBuffer.cpp \
CZipReader.cpp \
IBurningShader.cpp \
Irrlicht.cpp \
irrXML.cpp \
os.cpp \
bzip2/blocksort.c \
bzip2/bzcompress.c \
bzip2/bzlib.c \
bzip2/crctable.c \
bzip2/decompress.c \
bzip2/huffman.c \
bzip2/randtable.c \
jpeglib/jaricom.c \
jpeglib/jcapimin.c \
jpeglib/jcapistd.c \
jpeglib/jcarith.c \
jpeglib/jccoefct.c \
jpeglib/jccolor.c \
jpeglib/jcdctmgr.c \
jpeglib/jchuff.c \
jpeglib/jcinit.c \
jpeglib/jcmainct.c \
jpeglib/jcmarker.c \
jpeglib/jcmaster.c \
jpeglib/jcomapi.c \
jpeglib/jcparam.c \
jpeglib/jcprepct.c \
jpeglib/jcsample.c \
jpeglib/jctrans.c \
jpeglib/jdapimin.c \
jpeglib/jdapistd.c \
jpeglib/jdarith.c \
jpeglib/jdatadst.c \
jpeglib/jdatasrc.c \
jpeglib/jdcoefct.c \
jpeglib/jdcolor.c \
jpeglib/jddctmgr.c \
jpeglib/jdhuff.c \
jpeglib/jdinput.c \
jpeglib/jdmainct.c \
jpeglib/jdmarker.c \
jpeglib/jdmaster.c \
jpeglib/jdmerge.c \
jpeglib/jdpostct.c \
jpeglib/jdsample.c \
jpeglib/jdtrans.c \
jpeglib/jerror.c \
jpeglib/jfdctflt.c \
jpeglib/jfdctfst.c \
jpeglib/jfdctint.c \
jpeglib/jidctflt.c \
jpeglib/jidctfst.c \
jpeglib/jidctint.c \
jpeglib/jmemmgr.c \
jpeglib/jmemnobs.c \
jpeglib/jquant1.c \
jpeglib/jquant2.c \
jpeglib/jutils.c \
libpng/png.c \
libpng/pngerror.c \
libpng/pngget.c \
libpng/pngmem.c \
libpng/pngpread.c \
libpng/pngread.c \
libpng/pngrio.c \
libpng/pngrtran.c \
libpng/pngrutil.c \
libpng/pngset.c \
libpng/pngtrans.c \
libpng/pngwio.c \
libpng/pngwrite.c \
libpng/pngwtran.c \
libpng/pngwutil.c \
lzma/LzmaDec.c \
zlib/adler32.c zlib/crc32.c zlib/gzclose.c zlib/gzread.c zlib/infback.c zlib/inflate.c zlib/trees.c zlib/zutil.c\
zlib/compress.c zlib/deflate.c zlib/gzlib.c zlib/gzwrite.c zlib/inffast.c zlib/inftrees.c zlib/uncompr.c
LOCAL_STATIC_LIBRARIES := android_native_app_glue
include $(BUILD_STATIC_LIBRARY)
$(call import-module,android/native_app_glue)
all: $(IRRLICHT_LIB_PATH)
$(IRRLICHT_LIB_PATH) : $(TARGET_OUT)/$(IRRLICHT_LIB_NAME)
cp $< $@

View File

@ -1,2 +0,0 @@
APP_PLATFORM := android-10
APP_MODULES := Irrlicht

View File

@ -18,9 +18,8 @@
#include <GL/gl.h>
#include <GL/glx.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include "glext.h"
#undef GLX_ARB_get_proc_address // avoid problems with local glxext.h
#include "glxext.h"
#include <GL/glext.h>
#include <GL/glxext.h>
#endif
namespace irr
@ -294,7 +293,11 @@ bool CGLXManager::generateSurface()
return false;
}
CurrentContext.OpenGLLinux.X11Window=GlxWin;
CurrentContext.OpenGLLinux.GLXWindow=GlxWin;
}
else
{
CurrentContext.OpenGLLinux.GLXWindow=CurrentContext.OpenGLLinux.X11Window;
}
return true;
}
@ -353,13 +356,14 @@ bool CGLXManager::activateContext(const SExposedVideoData& videoData, bool resto
{
if (videoData.OpenGLLinux.X11Display && videoData.OpenGLLinux.X11Context)
{
if (!glXMakeCurrent((Display*)videoData.OpenGLLinux.X11Display, videoData.OpenGLLinux.X11Window, (GLXContext)videoData.OpenGLLinux.X11Context))
if (!glXMakeCurrent((Display*)videoData.OpenGLLinux.X11Display, videoData.OpenGLLinux.GLXWindow, (GLXContext)videoData.OpenGLLinux.X11Context))
{
os::Printer::log("Context activation failed.");
return false;
}
else
{
CurrentContext.OpenGLLinux.GLXWindow = videoData.OpenGLLinux.GLXWindow;
CurrentContext.OpenGLLinux.X11Window = videoData.OpenGLLinux.X11Window;
CurrentContext.OpenGLLinux.X11Display = videoData.OpenGLLinux.X11Display;
}
@ -367,13 +371,14 @@ bool CGLXManager::activateContext(const SExposedVideoData& videoData, bool resto
else
{
// in case we only got a window ID, try with the existing values for display and context
if (!glXMakeCurrent((Display*)PrimaryContext.OpenGLLinux.X11Display, videoData.OpenGLLinux.X11Window, (GLXContext)PrimaryContext.OpenGLLinux.X11Context))
if (!glXMakeCurrent((Display*)PrimaryContext.OpenGLLinux.X11Display, videoData.OpenGLLinux.GLXWindow, (GLXContext)PrimaryContext.OpenGLLinux.X11Context))
{
os::Printer::log("Context activation failed.");
return false;
}
else
{
CurrentContext.OpenGLLinux.GLXWindow = videoData.OpenGLLinux.GLXWindow;
CurrentContext.OpenGLLinux.X11Window = videoData.OpenGLLinux.X11Window;
CurrentContext.OpenGLLinux.X11Display = PrimaryContext.OpenGLLinux.X11Display;
}
@ -425,7 +430,7 @@ void CGLXManager::destroyContext()
bool CGLXManager::swapBuffers()
{
glXSwapBuffers((Display*)CurrentContext.OpenGLLinux.X11Display, CurrentContext.OpenGLLinux.X11Window);
glXSwapBuffers((Display*)CurrentContext.OpenGLLinux.X11Display, CurrentContext.OpenGLLinux.GLXWindow);
return true;
}

View File

@ -252,6 +252,10 @@ bool CGUIEditBox::OnEvent(const SEvent& event)
if (processMouse(event))
return true;
break;
case EET_STRING_INPUT_EVENT:
inputString(*event.StringInput.Str);
return true;
break;
default:
break;
}
@ -1391,14 +1395,20 @@ s32 CGUIEditBox::getLineFromPos(s32 pos)
void CGUIEditBox::inputChar(wchar_t c)
{
if (c == 0)
return;
core::stringw s(&c, 1);
inputString(s);
}
void CGUIEditBox::inputString(const core::stringw &str)
{
if (!isEnabled())
return;
if (c != 0)
{
{
core::stringw s;
u32 len = str.size();
if (MarkBegin != MarkEnd)
{
@ -1407,60 +1417,69 @@ void CGUIEditBox::inputChar(wchar_t c)
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
s = Text.subString(0, realmbgn);
s.append(c);
s.append(str);
s.append( Text.subString(realmend, Text.size()-realmend) );
Text = s;
CursorPos = realmbgn+1;
CursorPos = realmbgn+len;
}
else if ( OverwriteMode )
{
//check to see if we are at the end of the text
if ( (u32)CursorPos != Text.size())
if ( (u32)CursorPos+len < Text.size())
{
bool isEOL = (Text[CursorPos] == L'\n' ||Text[CursorPos] == L'\r' );
if (!isEOL || Text.size() < Max || Max == 0)
bool isEOL = false;
s32 EOLPos;
for (u32 i = CursorPos; i < CursorPos+len && i < Max; i++)
{
if (Text[i] == L'\n' || Text[i] == L'\r')
{
isEOL = true;
EOLPos = i;
break;
}
}
if (!isEOL || Text.size()+len <= Max || Max == 0)
{
s = Text.subString(0, CursorPos);
s.append(c);
s.append(str);
if ( isEOL )
{
//just keep appending to the current line
//This follows the behavior of other gui libraries behaviors
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
s.append( Text.subString(EOLPos, Text.size()-EOLPos) );
}
else
{
//replace the next character
s.append( Text.subString(CursorPos + 1,Text.size() - CursorPos + 1));
s.append( Text.subString(CursorPos + len,Text.size() - CursorPos - len));
}
Text = s;
++CursorPos;
CursorPos+=len;
}
}
else if (Text.size() < Max || Max == 0)
else if (Text.size()+len <= Max || Max == 0)
{
// add new character because we are at the end of the string
s = Text.subString(0, CursorPos);
s.append(c);
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
s.append(str);
s.append( Text.subString(CursorPos+len, Text.size()-CursorPos-len) );
Text = s;
++CursorPos;
CursorPos+=len;
}
}
else if (Text.size() < Max || Max == 0)
else if (Text.size()+len <= Max || Max == 0)
{
// add new character
s = Text.subString(0, CursorPos);
s.append(c);
s.append(str);
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
Text = s;
++CursorPos;
CursorPos+=len;
}
BlinkStartTime = os::Timer::getTime();
setTextMarkers(0, 0);
}
}
breakText();
calculateScrollPos();
sendGuiEvent(EGET_EDITBOX_CHANGED);
@ -1625,6 +1644,12 @@ void CGUIEditBox::sendGuiEvent(EGUI_EVENT_TYPE type)
}
}
//! Returns whether the element takes input from the IME
bool CGUIEditBox::acceptsIME()
{
return isEnabled();
}
//! Writes attributes of the element.
void CGUIEditBox::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{

View File

@ -139,6 +139,10 @@ namespace gui
//! Updates the absolute position, splits text if required
virtual void updateAbsolutePosition() _IRR_OVERRIDE_;
//! Returns whether the element takes input from the IME
virtual bool acceptsIME() _IRR_OVERRIDE_;
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
@ -154,6 +158,8 @@ namespace gui
s32 getLineFromPos(s32 pos);
//! adds a letter to the edit box
void inputChar(wchar_t c);
//! adds a string to the edit box
void inputString(const core::stringw &str);
//! calculates the current scroll position
void calculateScrollPos();
//! calculated the FrameRect

View File

@ -656,6 +656,10 @@ bool CGUIEnvironment::postEventFromUser(const SEvent& event)
}
}
break;
case EET_STRING_INPUT_EVENT:
if (Focus && Focus->OnEvent(event))
return true;
break;
default:
break;
} // end switch

View File

@ -224,13 +224,29 @@ void CImage::copyToScaling(void* target, u32 width, u32 height, ECOLOR_FORMAT fo
// Similar for y.
// As scaling is done without any antialiasing it doesn't matter too much which outermost pixels we use and keeping
// border pixels intact is probably mostly better (with AA the other solution would be more correct).
const f32 sourceXStep = width > 1 ? (f32)(Size.Width-1) / (f32)(width-1) : 0.f;
const f32 sourceYStep = height > 1 ? (f32)(Size.Height-1) / (f32)(height-1) : 0.f;
// This is however unnecessary (and unexpected) for scaling to integer multiples, so don't do it there.
f32 sourceXStep, sourceYStep;
f32 sourceXStart = 0.f, sourceYStart = 0.f;
if (width % Size.Width == 0)
sourceXStep = (f32)(Size.Width) / (f32)(width);
else
{
sourceXStep = width > 1 ? (f32)(Size.Width-1) / (f32)(width-1) : 0.f;
sourceXStart = 0.5f; // for rounding to nearest pixel
}
if (height % Size.Height == 0)
sourceYStep = (f32)(Size.Height) / (f32)(height);
else
{
sourceYStep = height > 1 ? (f32)(Size.Height-1) / (f32)(height-1) : 0.f;
sourceYStart = 0.5f; // for rounding to nearest pixel
}
s32 yval=0, syval=0;
f32 sy = 0.5f; // for rounding to nearest pixel
f32 sy = sourceYStart;
for (u32 y=0; y<height; ++y)
{
f32 sx = 0.5f; // for rounding to nearest pixel
f32 sx = sourceXStart;
for (u32 x=0; x<width; ++x)
{
CColorConverter::convert_viaFormat(Data+ syval + ((s32)sx)*BytesPerPixel, Format, 1, ((u8*)target)+ yval + (x*bpp), format);

View File

@ -14,11 +14,7 @@
#include <stdio.h> // required for jpeglib.h
#ifdef _IRR_COMPILE_WITH_LIBJPEG_
extern "C" {
#ifndef _IRR_USE_NON_SYSTEM_JPEG_LIB_
#include <jpeglib.h> // use system lib
#else
#include "jpeglib/jpeglib.h" // use irrlicht jpeglib
#endif
#include <setjmp.h>
}
#endif // _IRR_COMPILE_WITH_LIBJPEG_

View File

@ -7,11 +7,7 @@
#ifdef _IRR_COMPILE_WITH_PNG_LOADER_
#ifdef _IRR_COMPILE_WITH_LIBPNG_
#ifndef _IRR_USE_NON_SYSTEM_LIB_PNG_
#include <png.h> // use system lib png
#else // _IRR_USE_NON_SYSTEM_LIB_PNG_
#include "libpng/png.h" // use irrlicht included lib png
#endif // _IRR_USE_NON_SYSTEM_LIB_PNG_
#endif // _IRR_COMPILE_WITH_LIBPNG_
#include "CImage.h"

View File

@ -16,13 +16,8 @@
#include <stdio.h> // required for jpeglib.h
extern "C"
{
#ifndef _IRR_USE_NON_SYSTEM_JPEG_LIB_
#include <jpeglib.h>
#include <jerror.h>
#else
#include "jpeglib/jpeglib.h"
#include "jpeglib/jerror.h"
#endif
}

View File

@ -13,11 +13,7 @@
#include "os.h" // for logging
#ifdef _IRR_COMPILE_WITH_LIBPNG_
#ifndef _IRR_USE_NON_SYSTEM_LIB_PNG_
#include <png.h> // use system lib png
#else // _IRR_USE_NON_SYSTEM_LIB_PNG_
#include "libpng/png.h" // use irrlicht included lib png
#endif // _IRR_USE_NON_SYSTEM_LIB_PNG_
#endif // _IRR_COMPILE_WITH_LIBPNG_
namespace irr

View File

@ -13,6 +13,7 @@
#include <locale.h>
#include "IEventReceiver.h"
#include "ISceneManager.h"
#include "IGUIElement.h"
#include "IGUIEnvironment.h"
#include "os.h"
#include "CTimer.h"
@ -93,6 +94,7 @@ namespace
Atom X_ATOM_NETWM_MAXIMIZE_VERT;
Atom X_ATOM_NETWM_MAXIMIZE_HORZ;
Atom X_ATOM_NETWM_STATE;
Atom X_ATOM_NETWM_STATE_FULLSCREEN;
Atom X_ATOM_WM_DELETE_WINDOW;
@ -113,7 +115,6 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
#endif
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
WindowHasFocus(false), WindowMinimized(false),
UseXVidMode(false), UseXRandR(false),
ExternalWindow(false), AutorepeatSupport(0)
{
#ifdef _DEBUG
@ -147,6 +148,9 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
if (!createWindow())
return;
setResizable(param.WindowResizable);
#ifdef _IRR_COMPILE_WITH_X11_
createInputContext();
#endif
}
// create cursor control
@ -158,10 +162,6 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
if (!VideoDriver)
return;
#ifdef _IRR_COMPILE_WITH_X11_
createInputContext();
#endif
createGUIAndScene();
}
@ -206,9 +206,6 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
ContextManager->destroySurface();
}
// Reset fullscreen resolution change
switchToFullscreen(true);
if (SoftwareImage)
XDestroyImage(SoftwareImage);
@ -251,115 +248,34 @@ int IrrPrintXError(Display *display, XErrorEvent *event)
#endif
bool CIrrDeviceLinux::switchToFullscreen(bool reset)
bool CIrrDeviceLinux::switchToFullscreen()
{
if (!CreationParams.Fullscreen)
return true;
if (reset)
if (!HasNetWM)
{
#ifdef _IRR_LINUX_X11_VIDMODE_
if (UseXVidMode && CreationParams.Fullscreen)
{
XF86VidModeSwitchToMode(XDisplay, Screennr, &OldVideoMode);
XF86VidModeSetViewPort(XDisplay, Screennr, 0, 0);
os::Printer::log("NetWM support is required to allow Irrlicht to switch "
"to fullscreen mode. Running in windowed mode instead.", ELL_WARNING);
CreationParams.Fullscreen = false;
return false;
}
#endif
#ifdef _IRR_LINUX_X11_RANDR_
if (UseXRandR && CreationParams.Fullscreen)
{
XRRScreenConfiguration *config=XRRGetScreenInfo(XDisplay,DefaultRootWindow(XDisplay));
XRRSetScreenConfig(XDisplay,config,DefaultRootWindow(XDisplay),OldRandrMode,OldRandrRotation,CurrentTime);
XRRFreeScreenConfigInfo(config);
}
#endif
XEvent ev = {0};
ev.type = ClientMessage;
ev.xclient.window = XWindow;
ev.xclient.message_type = X_ATOM_NETWM_STATE;
ev.xclient.format = 32;
ev.xclient.data.l[0] = 1; // _NET_WM_STATE_ADD
ev.xclient.data.l[1] = X_ATOM_NETWM_STATE_FULLSCREEN;
XSendEvent(XDisplay, DefaultRootWindow(XDisplay), false,
SubstructureNotifyMask | SubstructureRedirectMask, &ev);
return true;
}
getVideoModeList();
#if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)
s32 eventbase, errorbase;
s32 bestMode = -1;
#endif
#ifdef _IRR_LINUX_X11_VIDMODE_
if (XF86VidModeQueryExtension(XDisplay, &eventbase, &errorbase))
{
// enumerate video modes
s32 modeCount;
XF86VidModeModeInfo** modes;
XF86VidModeGetAllModeLines(XDisplay, Screennr, &modeCount, &modes);
// find fitting mode
for (s32 i = 0; i<modeCount; ++i)
{
if (bestMode==-1 && modes[i]->hdisplay >= Width && modes[i]->vdisplay >= Height)
bestMode = i;
else if (bestMode!=-1 &&
modes[i]->hdisplay >= Width &&
modes[i]->vdisplay >= Height &&
modes[i]->hdisplay <= modes[bestMode]->hdisplay &&
modes[i]->vdisplay <= modes[bestMode]->vdisplay)
bestMode = i;
}
if (bestMode != -1)
{
os::Printer::log("Starting vidmode fullscreen mode...", ELL_INFORMATION);
os::Printer::log("hdisplay: ", core::stringc(modes[bestMode]->hdisplay).c_str(), ELL_INFORMATION);
os::Printer::log("vdisplay: ", core::stringc(modes[bestMode]->vdisplay).c_str(), ELL_INFORMATION);
XF86VidModeSwitchToMode(XDisplay, Screennr, modes[bestMode]);
XF86VidModeSetViewPort(XDisplay, Screennr, 0, 0);
UseXVidMode=true;
}
else
{
os::Printer::log("Could not find specified video mode, running windowed.", ELL_WARNING);
CreationParams.Fullscreen = false;
}
XFree(modes);
}
else
#endif
#ifdef _IRR_LINUX_X11_RANDR_
if (XRRQueryExtension(XDisplay, &eventbase, &errorbase))
{
s32 modeCount;
XRRScreenConfiguration *config=XRRGetScreenInfo(XDisplay,DefaultRootWindow(XDisplay));
XRRScreenSize *modes=XRRConfigSizes(config,&modeCount);
for (s32 i = 0; i<modeCount; ++i)
{
if (bestMode==-1 && (u32)modes[i].width >= Width && (u32)modes[i].height >= Height)
bestMode = i;
else if (bestMode!=-1 &&
(u32)modes[i].width >= Width &&
(u32)modes[i].height >= Height &&
modes[i].width <= modes[bestMode].width &&
modes[i].height <= modes[bestMode].height)
bestMode = i;
}
if (bestMode != -1)
{
os::Printer::log("Starting randr fullscreen mode...", ELL_INFORMATION);
os::Printer::log("width: ", core::stringc(modes[bestMode].width).c_str(), ELL_INFORMATION);
os::Printer::log("height: ", core::stringc(modes[bestMode].height).c_str(), ELL_INFORMATION);
XRRSetScreenConfig(XDisplay,config,DefaultRootWindow(XDisplay),bestMode,OldRandrRotation,CurrentTime);
UseXRandR=true;
}
XRRFreeScreenConfigInfo(config);
}
else
#endif
{
os::Printer::log("VidMode or RandR extension must be installed to allow Irrlicht "
"to switch to fullscreen mode. Running in windowed mode instead.", ELL_WARNING);
CreationParams.Fullscreen = false;
}
return CreationParams.Fullscreen;
}
#if defined(_IRR_COMPILE_WITH_X11_)
void IrrPrintXGrabError(int grabResult, const c8 * grabCommand )
@ -413,7 +329,12 @@ bool CIrrDeviceLinux::createWindow()
Screennr = DefaultScreen(XDisplay);
switchToFullscreen();
initXAtoms();
// check netwm support
Atom WMCheck = XInternAtom(XDisplay, "_NET_SUPPORTING_WM_CHECK", True);
if (WMCheck != None)
HasNetWM = true;
#if defined(_IRR_COMPILE_WITH_OPENGL_)
// don't use the XVisual with OpenGL, because it ignores all requested
@ -486,28 +407,21 @@ bool CIrrDeviceLinux::createWindow()
// create new Window
// Remove window manager decoration in fullscreen
WndAttributes.override_redirect = CreationParams.Fullscreen;
XWindow = XCreateWindow(XDisplay,
RootWindow(XDisplay, VisualInfo->screen),
x, y, Width, Height, 0, VisualInfo->depth,
InputOutput, VisualInfo->visual,
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
CWBorderPixel | CWColormap | CWEventMask,
&WndAttributes);
XMapRaised(XDisplay, XWindow);
CreationParams.WindowId = (void*)XWindow;
X_ATOM_WM_DELETE_WINDOW = XInternAtom(XDisplay, "WM_DELETE_WINDOW", True);
XSetWMProtocols(XDisplay, XWindow, &X_ATOM_WM_DELETE_WINDOW, 1);
if (CreationParams.Fullscreen)
{
XSetInputFocus(XDisplay, XWindow, RevertToParent, CurrentTime);
int grabKb = XGrabKeyboard(XDisplay, XWindow, True, GrabModeAsync,
GrabModeAsync, CurrentTime);
IrrPrintXGrabError(grabKb, "XGrabKeyboard");
int grabPointer = XGrabPointer(XDisplay, XWindow, True, ButtonPressMask,
GrabModeAsync, GrabModeAsync, XWindow, None, CurrentTime);
IrrPrintXGrabError(grabPointer, "XGrabPointer");
XWarpPointer(XDisplay, None, XWindow, 0, 0, 0, 0, 0, 0);
// Don't try to set window position
}
else if (CreationParams.WindowPosition.X >= 0 || CreationParams.WindowPosition.Y >= 0) // default is -1, -1
{
@ -536,6 +450,8 @@ bool CIrrDeviceLinux::createWindow()
ExternalWindow = true;
}
switchToFullscreen();
WindowMinimized=false;
// Currently broken in X, see Bug ID 2795321
// XkbSetDetectableAutoRepeat(XDisplay, True, &AutorepeatSupport);
@ -569,13 +485,6 @@ bool CIrrDeviceLinux::createWindow()
SoftwareImage->data = (char*) malloc(SoftwareImage->bytes_per_line * SoftwareImage->height * sizeof(char));
}
initXAtoms();
// check netwm support
Atom WMCheck = XInternAtom(XDisplay, "_NET_SUPPORTING_WM_CHECK", true);
if (WMCheck != None)
HasNetWM = true;
initXInput2();
#endif // #ifdef _IRR_COMPILE_WITH_X11_
@ -705,6 +614,14 @@ bool CIrrDeviceLinux::createInputContext()
return false;
}
// Load XMODIFIERS (e.g. for IMEs)
if (!XSetLocaleModifiers(""))
{
setlocale(LC_CTYPE, oldLocale.c_str());
os::Printer::log("XSetLocaleModifiers failed. Falling back to non-i18n input.", ELL_WARNING);
return false;
}
XInputMethod = XOpenIM(XDisplay, NULL, NULL, NULL);
if ( !XInputMethod )
{
@ -717,7 +634,7 @@ bool CIrrDeviceLinux::createInputContext()
XGetIMValues(XInputMethod, XNQueryInputStyle, &im_supported_styles, (char*)NULL);
XIMStyle bestStyle = 0;
// TODO: If we want to support languages like chinese or japanese as well we probably have to work with callbacks here.
XIMStyle supportedStyle = XIMPreeditNone | XIMStatusNone;
XIMStyle supportedStyle = XIMPreeditNothing | XIMStatusNothing;
for(int i=0; i < im_supported_styles->count_styles; ++i)
{
XIMStyle style = im_supported_styles->supported_styles[i];
@ -783,23 +700,18 @@ EKEY_CODE CIrrDeviceLinux::getKeyCode(XEvent &event)
}
if (keyCode == 0)
{
// Any value is better than none, that allows at least using the keys.
// Worst case is that some keys will be identical, still better than _all_
// unknown keys being identical.
keyCode = KEY_UNKNOWN;
if ( !mp.X11Key )
{
keyCode = (EKEY_CODE)event.xkey.keycode;
os::Printer::log("No such X11Key, using event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION);
os::Printer::log("No such X11Key, event keycode", core::stringc(event.xkey.keycode).c_str(), ELL_INFORMATION);
}
else if (idx == -1)
{
keyCode = (EKEY_CODE)mp.X11Key;
os::Printer::log("EKEY_CODE not found, using orig. X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
os::Printer::log("EKEY_CODE not found, X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
}
else
{
keyCode = (EKEY_CODE)mp.X11Key;
os::Printer::log("EKEY_CODE is 0, using orig. X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
os::Printer::log("EKEY_CODE is 0, X11 keycode", core::stringc(mp.X11Key).c_str(), ELL_INFORMATION);
}
}
return keyCode;
@ -825,6 +737,8 @@ bool CIrrDeviceLinux::run()
{
XEvent event;
XNextEvent(XDisplay, &event);
if (XFilterEvent(&event, None))
continue;
switch (event.type)
{
@ -1001,9 +915,9 @@ bool CIrrDeviceLinux::run()
SKeyMap mp;
if ( XInputContext )
{
wchar_t buf[8]={0};
wchar_t buf[64]={0};
Status status;
int strLen = XwcLookupString(XInputContext, &event.xkey, buf, sizeof(buf), &mp.X11Key, &status);
int strLen = XwcLookupString(XInputContext, &event.xkey, buf, sizeof(buf)/sizeof(wchar_t)-1, &mp.X11Key, &status);
if ( status == XBufferOverflow )
{
os::Printer::log("XwcLookupString needs a larger buffer", ELL_INFORMATION);
@ -1011,9 +925,20 @@ bool CIrrDeviceLinux::run()
if ( strLen > 0 && (status == XLookupChars || status == XLookupBoth) )
{
if (strLen > 1)
os::Printer::log("Additional returned characters dropped", ELL_INFORMATION);
{
// Multiple characters: send string event
irrevent.EventType = irr::EET_STRING_INPUT_EVENT;
irrevent.StringInput.Str = new core::stringw(buf);
postEventFromUser(irrevent);
delete irrevent.StringInput.Str;
irrevent.StringInput.Str = NULL;
break;
}
else
{
irrevent.KeyInput.Char = buf[0];
}
}
else
{
#if 0 // Most of those are fine - but useful to have the info when debugging Irrlicht itself.
@ -1047,7 +972,6 @@ bool CIrrDeviceLinux::run()
irrevent.KeyInput.Control = (event.xkey.state & ControlMask) != 0;
irrevent.KeyInput.Shift = (event.xkey.state & ShiftMask) != 0;
irrevent.KeyInput.Key = getKeyCode(event);
postEventFromUser(irrevent);
}
break;
@ -1140,7 +1064,27 @@ bool CIrrDeviceLinux::run()
break;
} // end switch
// Update IME information
if (XInputContext && GUIEnvironment)
{
gui::IGUIElement *elem = GUIEnvironment->getFocus();
if (elem && elem->acceptsIME())
{
core::rect<s32> r = elem->getAbsolutePosition();
XPoint p;
p.x = (short)r.UpperLeftCorner.X;
p.y = (short)r.LowerRightCorner.Y;
XSetICFocus(XInputContext);
XVaNestedList l = XVaCreateNestedList(0, XNSpotLocation, &p, NULL);
XSetICValues(XInputContext, XNPreeditAttributes, l, NULL);
XFree(l);
} else {
XUnsetICFocus(XInputContext);
}
}
} // end while
}
#endif //_IRR_COMPILE_WITH_X11_
@ -1331,84 +1275,6 @@ void CIrrDeviceLinux::setWindowSize(const irr::core::dimension2d<u32>& size)
#endif // #ifdef _IRR_COMPILE_WITH_X11_
}
//! Return pointer to a list with all video modes supported by the gfx adapter.
video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
{
#ifdef _IRR_COMPILE_WITH_X11_
if (!VideoModeList->getVideoModeCount())
{
bool temporaryDisplay = false;
if (!XDisplay)
{
XDisplay = XOpenDisplay(0);
temporaryDisplay=true;
}
if (XDisplay)
{
#if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)
s32 eventbase, errorbase;
s32 defaultDepth=DefaultDepth(XDisplay,Screennr);
#endif
#ifdef _IRR_LINUX_X11_VIDMODE_
if (XF86VidModeQueryExtension(XDisplay, &eventbase, &errorbase))
{
// enumerate video modes
int modeCount;
XF86VidModeModeInfo** modes;
XF86VidModeGetAllModeLines(XDisplay, Screennr, &modeCount, &modes);
// save current video mode
OldVideoMode = *modes[0];
// find fitting mode
VideoModeList->setDesktop(defaultDepth, core::dimension2d<u32>(
modes[0]->hdisplay, modes[0]->vdisplay));
for (int i = 0; i<modeCount; ++i)
{
VideoModeList->addMode(core::dimension2d<u32>(
modes[i]->hdisplay, modes[i]->vdisplay), defaultDepth);
}
XFree(modes);
}
else
#endif
#ifdef _IRR_LINUX_X11_RANDR_
if (XRRQueryExtension(XDisplay, &eventbase, &errorbase))
{
int modeCount;
XRRScreenConfiguration *config=XRRGetScreenInfo(XDisplay,DefaultRootWindow(XDisplay));
OldRandrMode=XRRConfigCurrentConfiguration(config,&OldRandrRotation);
XRRScreenSize *modes=XRRConfigSizes(config,&modeCount);
VideoModeList->setDesktop(defaultDepth, core::dimension2d<u32>(
modes[OldRandrMode].width, modes[OldRandrMode].height));
for (int i = 0; i<modeCount; ++i)
{
VideoModeList->addMode(core::dimension2d<u32>(
modes[i].width, modes[i].height), defaultDepth);
}
XRRFreeScreenConfigInfo(config);
}
else
#endif
{
os::Printer::log("VidMode or RandR X11 extension requireed for VideoModeList." , ELL_WARNING);
}
}
if (XDisplay && temporaryDisplay)
{
XCloseDisplay(XDisplay);
XDisplay=0;
}
}
#endif
return VideoModeList;
}
//! Minimize window
void CIrrDeviceLinux::minimizeWindow()
@ -2017,6 +1883,7 @@ void CIrrDeviceLinux::initXAtoms()
X_ATOM_NETWM_MAXIMIZE_VERT = XInternAtom(XDisplay, "_NET_WM_STATE_MAXIMIZED_VERT", true);
X_ATOM_NETWM_MAXIMIZE_HORZ = XInternAtom(XDisplay, "_NET_WM_STATE_MAXIMIZED_HORZ", true);
X_ATOM_NETWM_STATE = XInternAtom(XDisplay, "_NET_WM_STATE", true);
X_ATOM_NETWM_STATE_FULLSCREEN = XInternAtom(XDisplay, "_NET_WM_STATE_FULLSCREEN", True);
#endif
}

View File

@ -76,10 +76,6 @@ namespace irr
//! notifies the device that it should close itself
virtual void closeDevice() _IRR_OVERRIDE_;
//! \return Returns a pointer to a list with all video modes
//! supported by the gfx adapter.
virtual video::IVideoModeList* getVideoModeList() _IRR_OVERRIDE_;
//! Sets if the window should be resizable in windowed mode.
virtual void setResizable(bool resize=false) _IRR_OVERRIDE_;
@ -148,7 +144,7 @@ namespace irr
void initXInput2();
bool switchToFullscreen(bool reset=false);
bool switchToFullscreen();
#ifdef _IRR_COMPILE_WITH_X11_
bool createInputContext();
@ -390,19 +386,10 @@ namespace irr
XIC XInputContext;
bool HasNetWM;
mutable core::stringc Clipboard;
#ifdef _IRR_LINUX_X11_VIDMODE_
XF86VidModeModeInfo OldVideoMode;
#endif
#ifdef _IRR_LINUX_X11_RANDR_
SizeID OldRandrMode;
Rotation OldRandrRotation;
#endif
#endif
u32 Width, Height;
bool WindowHasFocus;
bool WindowMinimized;
bool UseXVidMode;
bool UseXRandR;
bool ExternalWindow;
int AutorepeatSupport;

View File

@ -821,6 +821,8 @@ void CIrrDeviceMacOSX::setResize(int width, int height)
{
NSRect driverFrame = [Window contentRectForFrameRect:[Window frame]];
getVideoDriver()->OnResize(core::dimension2d<u32>( (s32)driverFrame.size.width, (s32)driverFrame.size.height));
DeviceWidth = (s32)driverFrame.size.width;
DeviceHeight = (s32)driverFrame.size.height;
}
else
getVideoDriver()->OnResize(core::dimension2d<u32>( (s32)width, (s32)height));

View File

@ -6,6 +6,7 @@
#include "ISceneManager.h"
#include "IEventReceiver.h"
#include "IFileSystem.h"
#include "IGUIElement.h"
#include "IGUIEnvironment.h"
#include "os.h"
#include "IrrCompileConfig.h"
@ -503,6 +504,14 @@ void CIrrDeviceStub::clearSystemMessages()
{
}
//! Checks whether the input device should take input from the IME
bool CIrrDeviceStub::acceptsIME()
{
if (!GUIEnvironment)
return false;
gui::IGUIElement *elem = GUIEnvironment->getFocus();
return elem && elem->acceptsIME();
}
} // end namespace irr

View File

@ -194,6 +194,9 @@ namespace irr
void calculateGammaRamp ( u16 *ramp, f32 gamma, f32 relativebrightness, f32 relativecontrast );
void calculateGammaFromRamp ( f32 &gamma, const u16 *ramp );
//! Checks whether the input device should take input from the IME
bool acceptsIME();
video::IVideoDriver* VideoDriver;
gui::IGUIEnvironment* GUIEnvironment;
scene::ISceneManager* SceneManager;

View File

@ -935,29 +935,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_ACTIVATE:
// we need to take care for screen changes, e.g. Alt-Tab
dev = getDeviceFromHWnd(hWnd);
if (dev && dev->isFullscreen())
{
if ((wParam&0xFF)==WA_INACTIVE)
{
// If losing focus we minimize the app to show other one
ShowWindow(hWnd,SW_MINIMIZE);
// and switch back to default resolution
dev->switchToFullScreen(true);
}
else
{
// Otherwise we retore the fullscreen Irrlicht app
SetForegroundWindow(hWnd);
ShowWindow(hWnd, SW_RESTORE);
// and set the fullscreen resolution again
dev->switchToFullScreen();
}
}
break;
case WM_USER:
event.EventType = irr::EET_USER_EVENT;
event.UserEvent.UserData1 = static_cast<size_t>(wParam);
@ -994,7 +971,7 @@ namespace irr
//! constructor
CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
: CIrrDeviceStub(params), HWnd(0), ChangedToFullScreen(false), Resized(false),
: CIrrDeviceStub(params), HWnd(0), Resized(false),
ExternalWindow(false), Win32CursorControl(0), JoyControl(0)
{
#ifdef _DEBUG
@ -1010,13 +987,6 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
// get handle to exe file
HINSTANCE hInstance = GetModuleHandle(0);
// Store original desktop mode.
memset(&DesktopMode, 0, sizeof(DesktopMode));
DesktopMode.dmSize = sizeof(DesktopMode);
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &DesktopMode);
// create the window if we need to and we do not use the null device
if (!CreationParams.WindowId && CreationParams.DriverType != video::EDT_NULL)
{
@ -1160,8 +1130,6 @@ CIrrDeviceWin32::~CIrrDeviceWin32()
break;
}
}
switchToFullScreen(true);
}
@ -1228,7 +1196,7 @@ void CIrrDeviceWin32::createDriver()
os::Printer::log("OpenGL-ES2 driver was not compiled in.", ELL_ERROR);
#endif
break;
case EDT_WEBGL1:
case video::EDT_WEBGL1:
os::Printer::log("WebGL1 driver not supported on Win32 device.", ELL_ERROR);
break;
case video::EDT_SOFTWARE:
@ -1443,67 +1411,29 @@ bool CIrrDeviceWin32::isWindowMinimized() const
//! switches to fullscreen
bool CIrrDeviceWin32::switchToFullScreen(bool reset)
bool CIrrDeviceWin32::switchToFullScreen()
{
if (!CreationParams.Fullscreen)
return true;
if (reset)
// No border, title bar, etc. is already set up through getWindowStyle()
// We only set the window size to match the monitor.
MONITORINFO mi;
mi.cbSize = sizeof(mi);
if (GetMonitorInfo(MonitorFromWindow(HWnd,MONITOR_DEFAULTTOPRIMARY),&mi))
{
if (ChangedToFullScreen)
{
return (ChangeDisplaySettings(&DesktopMode,0)==DISP_CHANGE_SUCCESSFUL);
UINT flags = SWP_NOCOPYBITS|SWP_NOOWNERZORDER|SWP_FRAMECHANGED;
SetWindowPos(HWnd, HWND_TOP, mi.rcMonitor.left, mi.rcMonitor.top,
mi.rcMonitor.right - mi.rcMonitor.left,
mi.rcMonitor.bottom - mi.rcMonitor.top, flags);
}
else
return true;
}
// use default values from current setting
DEVMODE dm;
memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(dm);
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
dm.dmPelsWidth = CreationParams.WindowSize.Width;
dm.dmPelsHeight = CreationParams.WindowSize.Height;
dm.dmBitsPerPel = CreationParams.Bits;
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
LONG res = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
if (res != DISP_CHANGE_SUCCESSFUL)
{ // try again without forcing display frequency
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
res = ChangeDisplaySettings(&dm, CDS_FULLSCREEN);
}
bool ret = false;
switch(res)
{
case DISP_CHANGE_SUCCESSFUL:
ChangedToFullScreen = true;
ret = true;
break;
case DISP_CHANGE_RESTART:
os::Printer::log("Switch to fullscreen: The computer must be restarted in order for the graphics mode to work.", ELL_ERROR);
break;
case DISP_CHANGE_BADFLAGS:
os::Printer::log("Switch to fullscreen: An invalid set of flags was passed in.", ELL_ERROR);
break;
case DISP_CHANGE_BADPARAM:
os::Printer::log("Switch to fullscreen: An invalid parameter was passed in. This can include an invalid flag or combination of flags.", ELL_ERROR);
break;
case DISP_CHANGE_FAILED:
os::Printer::log("Switch to fullscreen: The display driver failed the specified graphics mode.", ELL_ERROR);
break;
case DISP_CHANGE_BADMODE:
os::Printer::log("Switch to fullscreen: The graphics mode is not supported.", ELL_ERROR);
break;
default:
os::Printer::log("An unknown error occurred while changing to fullscreen.", ELL_ERROR);
break;
CreationParams.Fullscreen = false;
}
return ret;
return CreationParams.Fullscreen;
}
@ -1514,33 +1444,6 @@ CIrrDeviceWin32::CCursorControl* CIrrDeviceWin32::getWin32CursorControl()
}
//! \return Returns a pointer to a list with all video modes supported
//! by the gfx adapter.
video::IVideoModeList* CIrrDeviceWin32::getVideoModeList()
{
if (!VideoModeList->getVideoModeCount())
{
// enumerate video modes.
DWORD i=0;
DEVMODE mode;
memset(&mode, 0, sizeof(mode));
mode.dmSize = sizeof(mode);
while (EnumDisplaySettings(NULL, i, &mode))
{
VideoModeList->addMode(core::dimension2d<u32>(mode.dmPelsWidth, mode.dmPelsHeight),
mode.dmBitsPerPel);
++i;
}
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &mode))
VideoModeList->setDesktop(mode.dmBitsPerPel, core::dimension2d<u32>(mode.dmPelsWidth, mode.dmPelsHeight));
}
return VideoModeList;
}
typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD);
// Needed for old windows apis
// depending on the SDK version and compilers some defines might be available

View File

@ -66,10 +66,6 @@ namespace irr
//! notifies the device that it should close itself
virtual void closeDevice() _IRR_OVERRIDE_;
//! \return Returns a pointer to a list with all video modes
//! supported by the gfx adapter.
virtual video::IVideoModeList* getVideoModeList() _IRR_OVERRIDE_;
//! Notifies the device, that it has been resized
/** Must be publis as it is called from free function (event handler) */
void OnResized();
@ -119,7 +115,7 @@ namespace irr
}
//! Switch to fullscreen
bool switchToFullScreen(bool reset=false);
bool switchToFullScreen();
//! Check for and show last Windows API error to help internal debugging.
//! Does call GetLastError and on errors formats the error text and displays it in a messagebox.
@ -432,11 +428,9 @@ namespace irr
HWND HWnd;
bool ChangedToFullScreen;
bool Resized;
bool ExternalWindow;
CCursorControl* Win32CursorControl;
DEVMODE DesktopMode;
SJoystickWin32Control* JoyControl;
};

View File

@ -0,0 +1,444 @@
add_definitions(-DIRRLICHT_EXPORTS=1)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-D_DEBUG)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
# Compiler flags
if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
add_compile_options(-Wall -pipe -fno-exceptions -fno-rtti)
elseif(MSVC)
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " msvcrt.lib") # ???? fuck off
add_compile_options(/GR- /Zl)
endif()
# Required libs
find_package(ZLIB REQUIRED)
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
# To configure the features available in this Irrlicht build please edit
# include/IrrCompileConfig.h and re-run CMake from a clean state
include(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${PROJECT_SOURCE_DIR}/include)
unset(OGLES1_ENABLED CACHE)
unset(OGLES2_ENABLED CACHE)
unset(OGL_ENABLED CACHE)
check_symbol_exists(_IRR_COMPILE_WITH_OGLES1_ "IrrCompileConfig.h" OGLES1_ENABLED)
if(OGLES1_ENABLED)
# only tested on Android, probably works on Linux (is this needed anywhere else?)
find_library(OPENGLES_LIBRARY NAMES GLESv1_CM REQUIRED)
find_library(EGL_LIBRARY NAMES EGL REQUIRED)
message(STATUS "Found OpenGLES: ${OPENGLES_LIBRARY}")
endif()
check_symbol_exists(_IRR_COMPILE_WITH_OGLES2_ "IrrCompileConfig.h" OGLES2_ENABLED)
if(OGLES2_ENABLED)
find_package(OpenGLES2 REQUIRED)
endif()
check_symbol_exists(_IRR_COMPILE_WITH_OPENGL_ "IrrCompileConfig.h" OGL_ENABLED)
if(OGL_ENABLED)
set(OpenGL_GL_PREFERENCE "LEGACY")
find_package(OpenGL REQUIRED)
endif()
# Platform-specific libs
if(ANDROID)
enable_language(C)
add_library(native_app_glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
elseif(APPLE)
find_library(COCOA_LIB Cocoa REQUIRED)
find_library(IOKIT_LIB IOKit REQUIRED)
add_definitions(-DGL_SILENCE_DEPRECATION)
else()
# Unix probably
find_package(X11 REQUIRED)
endif()
set(link_includes
"${PROJECT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${ZLIB_INCLUDE_DIR}"
"${JPEG_INCLUDE_DIR}"
"${PNG_INCLUDE_DIR}"
${OPENGL_INCLUDE_DIR}
${OPENGLES2_INCLUDE_DIR}
${EGL_INCLUDE_DIR}
"$<$<PLATFORM_ID:Android>:${ANDROID_NDK}/sources/android/native_app_glue>"
${X11_INCLUDE_DIR}
)
set(link_libs
"${ZLIB_LIBRARY}"
"${JPEG_LIBRARY}"
"${PNG_LIBRARY}"
${OPENGL_LIBRARIES}
${OPENGLES_LIBRARY}
${OPENGLES2_LIBRARIES}
${EGL_LIBRARY}
"$<$<PLATFORM_ID:Android>:native_app_glue -landroid -llog>"
${COCOA_LIB}
${IOKIT_LIB}
"$<$<PLATFORM_ID:Windows>:gdi32>"
"$<$<PLATFORM_ID:Windows>:winmm>"
${X11_X11_LIB}
${X11_Xxf86vm_LIB}
)
# Source files
set(IRRMESHLOADER
CBSPMeshFileLoader.cpp
CMD2MeshFileLoader.cpp
CMD3MeshFileLoader.cpp
CMS3DMeshFileLoader.cpp
CB3DMeshFileLoader.cpp
C3DSMeshFileLoader.cpp
COgreMeshFileLoader.cpp
COBJMeshFileLoader.cpp
CColladaFileLoader.cpp
CCSMLoader.cpp
CDMFLoader.cpp
CLMTSMeshFileLoader.cpp
CMY3DMeshFileLoader.cpp
COCTLoader.cpp
CXMeshFileLoader.cpp
CIrrMeshFileLoader.cpp
CSTLMeshFileLoader.cpp
CLWOMeshFileLoader.cpp
CPLYMeshFileLoader.cpp
CSMFMeshFileLoader.cpp
CMeshTextureLoader.cpp
)
set(IRRMESHWRITER
CColladaMeshWriter.cpp
CIrrMeshWriter.cpp
CSTLMeshWriter.cpp
COBJMeshWriter.cpp
CPLYMeshWriter.cpp
CB3DMeshWriter.cpp
)
add_library(IRRMESHOBJ OBJECT
CSkinnedMesh.cpp
CBoneSceneNode.cpp
CMeshSceneNode.cpp
CAnimatedMeshSceneNode.cpp
CAnimatedMeshMD2.cpp
CAnimatedMeshMD3.cpp
CQ3LevelMesh.cpp
CQuake3ShaderSceneNode.cpp
CAnimatedMeshHalfLife.cpp
${IRRMESHLOADER}
${IRRMESHWRITER}
)
add_library(IRROBJ OBJECT
CBillboardSceneNode.cpp
CCameraSceneNode.cpp
CDummyTransformationSceneNode.cpp
CEmptySceneNode.cpp
CGeometryCreator.cpp
CLightSceneNode.cpp
CMeshManipulator.cpp
CMetaTriangleSelector.cpp
COctreeSceneNode.cpp
COctreeTriangleSelector.cpp
CSceneCollisionManager.cpp
CSceneManager.cpp
CShadowVolumeSceneNode.cpp
CSkyBoxSceneNode.cpp
CSkyDomeSceneNode.cpp
CTerrainSceneNode.cpp
CTerrainTriangleSelector.cpp
CVolumeLightSceneNode.cpp
CCubeSceneNode.cpp
CSphereSceneNode.cpp
CTextSceneNode.cpp
CTriangleBBSelector.cpp
CTriangleSelector.cpp
CWaterSurfaceSceneNode.cpp
CMeshCache.cpp
CDefaultSceneNodeAnimatorFactory.cpp
CDefaultSceneNodeFactory.cpp
CSceneLoaderIrr.cpp
)
add_library(IRRPARTICLEOBJ OBJECT
CParticleAnimatedMeshSceneNodeEmitter.cpp
CParticleBoxEmitter.cpp
CParticleCylinderEmitter.cpp
CParticleMeshEmitter.cpp
CParticlePointEmitter.cpp
CParticleRingEmitter.cpp
CParticleSphereEmitter.cpp
CParticleAttractionAffector.cpp
CParticleFadeOutAffector.cpp
CParticleGravityAffector.cpp
CParticleRotationAffector.cpp
CParticleSystemSceneNode.cpp
CParticleScaleAffector.cpp
)
add_library(IRRANIMOBJ OBJECT
CSceneNodeAnimatorCameraFPS.cpp
CSceneNodeAnimatorCameraMaya.cpp
CSceneNodeAnimatorCollisionResponse.cpp
CSceneNodeAnimatorDelete.cpp
CSceneNodeAnimatorFlyCircle.cpp
CSceneNodeAnimatorFlyStraight.cpp
CSceneNodeAnimatorFollowSpline.cpp
CSceneNodeAnimatorRotation.cpp
CSceneNodeAnimatorTexture.cpp
)
set(IRRDRVROBJ
CNullDriver.cpp
COpenGLCacheHandler.cpp
COpenGLDriver.cpp
COpenGLNormalMapRenderer.cpp
COpenGLParallaxMapRenderer.cpp
COpenGLShaderMaterialRenderer.cpp
COpenGLSLMaterialRenderer.cpp
COpenGLExtensionHandler.cpp
CD3D9Driver.cpp
CD3D9HLSLMaterialRenderer.cpp
CD3D9NormalMapRenderer.cpp
CD3D9ParallaxMapRenderer.cpp
CD3D9ShaderMaterialRenderer.cpp
CD3D9Texture.cpp
COGLESDriver.cpp
COGLESExtensionHandler.cpp
COGLES2Driver.cpp
COGLES2ExtensionHandler.cpp
COGLES2FixedPipelineRenderer.cpp
COGLES2MaterialRenderer.cpp
COGLES2NormalMapRenderer.cpp
COGLES2ParallaxMapRenderer.cpp
COGLES2Renderer2D.cpp
CWebGL1Driver.cpp
CGLXManager.cpp
CWGLManager.cpp
CEGLManager.cpp
)
set(IRRIMAGEOBJ
CColorConverter.cpp
CImage.cpp
CImageLoaderBMP.cpp
CImageLoaderDDS.cpp
CImageLoaderJPG.cpp
CImageLoaderPCX.cpp
CImageLoaderPNG.cpp
CImageLoaderPSD.cpp
CImageLoaderPVR.cpp
CImageLoaderTGA.cpp
CImageLoaderPPM.cpp
CImageLoaderWAL.cpp
CImageLoaderRGB.cpp
CImageWriterBMP.cpp
CImageWriterJPG.cpp
CImageWriterPCX.cpp
CImageWriterPNG.cpp
CImageWriterPPM.cpp
CImageWriterPSD.cpp
CImageWriterTGA.cpp
)
add_library(IRRVIDEOOBJ OBJECT
CVideoModeList.cpp
CFPSCounter.cpp
${IRRDRVROBJ}
${IRRIMAGEOBJ}
)
add_library(IRRSWRENDEROBJ OBJECT
CSoftwareDriver.cpp
CSoftwareTexture.cpp
CTRFlat.cpp
CTRFlatWire.cpp
CTRGouraud.cpp
CTRGouraudWire.cpp
CTRNormalMap.cpp
CTRStencilShadow.cpp
CTRTextureFlat.cpp
CTRTextureFlatWire.cpp
CTRTextureGouraud.cpp
CTRTextureGouraudAdd.cpp
CTRTextureGouraudNoZ.cpp
CTRTextureGouraudWire.cpp
CZBuffer.cpp
CTRTextureGouraudVertexAlpha2.cpp
CTRTextureGouraudNoZ2.cpp
CTRTextureLightMap2_M2.cpp
CTRTextureLightMap2_M4.cpp
CTRTextureLightMap2_M1.cpp
CSoftwareDriver2.cpp
CSoftwareTexture2.cpp
CTRTextureGouraud2.cpp
CTRGouraud2.cpp
CTRGouraudAlpha2.cpp
CTRGouraudAlphaNoZ2.cpp
CTRTextureDetailMap2.cpp
CTRTextureGouraudAdd2.cpp
CTRTextureGouraudAddNoZ2.cpp
CTRTextureWire2.cpp
CTRTextureLightMap2_Add.cpp
CTRTextureLightMapGouraud2_M4.cpp
IBurningShader.cpp
CTRTextureBlend.cpp
CTRTextureGouraudAlpha.cpp
CTRTextureGouraudAlphaNoZ.cpp
CDepthBuffer.cpp
CBurningShader_Raster_Reference.cpp
CTR_transparent_reflection_2_layer.cpp
CTRGouraudNoZ2.cpp
burning_shader_color.cpp
)
add_library(IRRIOOBJ OBJECT
CFileList.cpp
CFileSystem.cpp
CLimitReadFile.cpp
CMemoryFile.cpp
CReadFile.cpp
CWriteFile.cpp
CXMLReader.cpp
CXMLWriter.cpp
CWADReader.cpp
CZipReader.cpp
CPakReader.cpp
CNPKReader.cpp
CTarReader.cpp
CMountPointReader.cpp
irrXML.cpp
CAttributes.cpp
)
add_library(IRROTHEROBJ OBJECT
CIrrDeviceSDL.cpp
CIrrDeviceLinux.cpp
CIrrDeviceConsole.cpp
CIrrDeviceStub.cpp
CIrrDeviceWin32.cpp
CIrrDeviceFB.cpp
CLogger.cpp
COSOperator.cpp
Irrlicht.cpp
os.cpp
leakHunter.cpp
CProfiler.cpp
utf8.cpp
)
if(ANDROID)
target_sources(IRROTHEROBJ PRIVATE
Android/CIrrDeviceAndroid.cpp
Android/CAndroidAssetReader.cpp
Android/CAndroidAssetFileArchive.cpp
Android/CKeyEventWrapper.cpp
)
elseif(APPLE)
# Build all IRROTHEROBJ sources as objc++, including the .cpp's
set_target_properties(IRROTHEROBJ PROPERTIES COMPILE_OPTIONS "-xobjective-c++")
target_sources(IRROTHEROBJ PRIVATE
CIrrDeviceOSX.mm
CNSOGLManager.mm
)
endif()
add_library(IRRGUIOBJ OBJECT
CGUIButton.cpp
CGUICheckBox.cpp
CGUIComboBox.cpp
CGUIContextMenu.cpp
CGUIEditBox.cpp
CGUIEnvironment.cpp
CGUIFileOpenDialog.cpp
CGUIFont.cpp
CGUIImage.cpp
CGUIInOutFader.cpp
CGUIListBox.cpp
CGUIMenu.cpp
CGUIMeshViewer.cpp
CGUIMessageBox.cpp
CGUIModalScreen.cpp
CGUIScrollBar.cpp
CGUISpinBox.cpp
CGUISkin.cpp
CGUIStaticText.cpp
CGUITabControl.cpp
CGUITable.cpp
CGUIToolBar.cpp
CGUIWindow.cpp
CGUIColorSelectDialog.cpp
CDefaultGUIElementFactory.cpp
CGUISpriteBank.cpp
CGUIImageList.cpp
CGUITreeView.cpp
CGUIProfiler.cpp
)
# Library
option(BUILD_SHARED_LIBS "Build shared library" TRUE)
add_library(IrrlichtMt)
foreach(object_lib
IRRMESHOBJ IRROBJ IRRPARTICLEOBJ IRRANIMOBJ IRRVIDEOOBJ IRRSWRENDEROBJ
IRRIOOBJ IRROTHEROBJ IRRGUIOBJ)
# Set include directories for object library compilation
target_include_directories(${object_lib} PRIVATE ${link_includes})
# Add objects from object library to main library
target_sources(IrrlichtMt PRIVATE $<TARGET_OBJECTS:${object_lib}>)
endforeach()
# Alias target provides add_submodule compatibility
add_library(IrrlichtMt::IrrlichtMt ALIAS IrrlichtMt)
target_include_directories(IrrlichtMt
PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/irrlichtmt>"
PRIVATE
${link_includes}
)
target_link_libraries(IrrlichtMt PRIVATE ${link_libs})
set_target_properties(IrrlichtMt PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
if(WIN32)
set_target_properties(IrrlichtMt PROPERTIES PREFIX "") # for DLL name
endif()
# Installation of library
if(ANDROID)
set(INSTALL_TARGETS IrrlichtMt native_app_glue)
else()
set(INSTALL_TARGETS IrrlichtMt)
endif()
install(TARGETS ${INSTALL_TARGETS}
EXPORT IrrlichtMt-export
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)

View File

@ -52,14 +52,14 @@ bool CMemoryReadFile::seek(long finalPos, bool relativeMovement)
{
if (relativeMovement)
{
if (Pos + finalPos > Len)
if (Pos + finalPos < 0 || Pos + finalPos > Len)
return false;
Pos += finalPos;
}
else
{
if (finalPos > Len)
if (finalPos < 0 || finalPos > Len)
return false;
Pos = finalPos;
@ -133,14 +133,14 @@ bool CMemoryWriteFile::seek(long finalPos, bool relativeMovement)
{
if (relativeMovement)
{
if (Pos + finalPos > Len)
if (Pos + finalPos < 0 || Pos + finalPos > Len)
return false;
Pos += finalPos;
}
else
{
if (finalPos > Len)
if (finalPos < 0 || finalPos > Len)
return false;
Pos = finalPos;

View File

@ -725,7 +725,9 @@ video::ITexture* CNullDriver::findTexture(const io::path& filename)
ITexture* CNullDriver::createDeviceDependentTexture(const io::path& name, IImage* image)
{
return new SDummyTexture(name, ETT_2D);
SDummyTexture* dummy = new SDummyTexture(name, ETT_2D);
dummy->setSize(image->getDimension());
return dummy;
}
ITexture* CNullDriver::createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image)

View File

@ -783,6 +783,8 @@ namespace video
{
SDummyTexture(const io::path& name, E_TEXTURE_TYPE type) : ITexture(name, type) {};
void setSize(const core::dimension2d<u32>& size) { Size = OriginalSize = size; }
virtual void* lock(E_TEXTURE_LOCK_MODE mode = ETLM_READ_WRITE, u32 mipmapLevel=0, u32 layer = 0, E_TEXTURE_LOCK_FLAGS lockFlags = ETLF_FLIP_Y_UP_RTT) _IRR_OVERRIDE_ { return 0; }
virtual void unlock()_IRR_OVERRIDE_ {}
virtual void regenerateMipMapLevels(void* data = 0, u32 layer = 0) _IRR_OVERRIDE_ {}

View File

@ -29,7 +29,7 @@
#include <EGL/eglplatform.h>
typedef char GLchar;
#if defined(_IRR_OGLES2_USE_EXTPOINTER_)
#include "gles2-ext.h"
#include <GLES2/gl2ext.h>
#endif
#endif

View File

@ -2099,6 +2099,13 @@ COGLES2Driver::~COGLES2Driver()
}
void COGLES2Driver::setViewPortRaw(u32 width, u32 height)
{
CacheHandler->setViewport(0, 0, width, height);
ViewPort = core::recti(0, 0, width, height);
}
//! Draws a shadow volume into the stencil buffer.
void COGLES2Driver::drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible)
{
@ -2460,7 +2467,7 @@ COGLES2Driver::~COGLES2Driver()
destRenderTargetSize = renderTarget->getSize();
CacheHandler->setViewport(0, 0, destRenderTargetSize.Width, destRenderTargetSize.Height);
setViewPortRaw(destRenderTargetSize.Width, destRenderTargetSize.Height);
}
else
{
@ -2468,7 +2475,7 @@ COGLES2Driver::~COGLES2Driver()
destRenderTargetSize = core::dimension2d<u32>(0, 0);
CacheHandler->setViewport(0, 0, ScreenSize.Width, ScreenSize.Height);
setViewPortRaw(ScreenSize.Width, ScreenSize.Height);
}
if (CurrentRenderTargetSize != destRenderTargetSize)
@ -2591,6 +2598,22 @@ COGLES2Driver::~COGLES2Driver()
}
delete [] tmpBuffer;
// also GL_RGBA doesn't match the internal encoding of the image (which is BGRA)
if (GL_RGBA == internalformat && GL_UNSIGNED_BYTE == type)
{
pixels = static_cast<u8*>(newImage->getData());
for (u32 i = 0; i < ScreenSize.Height; i++)
{
for (u32 j = 0; j < ScreenSize.Width; j++)
{
u32 c = *(u32*) (pixels + 4 * j);
*(u32*) (pixels + 4 * j) = (c & 0xFF00FF00) |
((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
}
pixels += pitch;
}
}
if (testGLError(__LINE__))
{
newImage->drop();

View File

@ -379,6 +379,9 @@ namespace video
bool setMaterialTexture(irr::u32 layerIdx, const irr::video::ITexture* texture);
//! Same as `CacheHandler->setViewport`, but also sets `ViewPort`
virtual void setViewPortRaw(u32 width, u32 height);
COGLES2CacheHandler* CacheHandler;
core::stringw Name;
core::stringc VendorName;

View File

@ -20,9 +20,6 @@ typedef char GLchar;
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/eglplatform.h>
#if defined(_IRR_OGLES1_USE_EXTPOINTER_)
#include "gles-ext.h"
#endif
#endif
#ifndef GL_BGRA

View File

@ -2330,6 +2330,13 @@ void COGLES1Driver::setViewPort(const core::rect<s32>& area)
}
void COGLES1Driver::setViewPortRaw(u32 width, u32 height)
{
CacheHandler->setViewport(0, 0, width, height);
ViewPort = core::recti(0, 0, width, height);
}
//! Draws a shadow volume into the stencil buffer.
void COGLES1Driver::drawStencilShadowVolume(const core::array<core::vector3df>& triangles, bool zfail, u32 debugDataVisible)
{
@ -2779,7 +2786,7 @@ bool COGLES1Driver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SCol
destRenderTargetSize = renderTarget->getSize();
CacheHandler->setViewport(0, 0, destRenderTargetSize.Width, destRenderTargetSize.Height);
setViewPortRaw(destRenderTargetSize.Width, destRenderTargetSize.Height);
}
else
{
@ -2805,7 +2812,7 @@ bool COGLES1Driver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SCol
destRenderTargetSize = core::dimension2d<u32>(0, 0);
CacheHandler->setViewport(0, 0, ScreenSize.Width, ScreenSize.Height);
setViewPortRaw(ScreenSize.Width, ScreenSize.Height);
}
if (CurrentRenderTargetSize != destRenderTargetSize)

View File

@ -342,6 +342,9 @@ namespace video
//! \param[in] lightIndex: the index of the requesting light
void assignHardwareLight(u32 lightIndex);
//! Same as `CacheHandler->setViewport`, but also sets `ViewPort`
virtual void setViewPortRaw(u32 width, u32 height);
COGLES1CacheHandler* CacheHandler;
core::stringw Name;

View File

@ -17,9 +17,9 @@
#endif
#include <GL/gl.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include "glext.h"
#include <GL/glext.h>
#endif
#include "wglext.h"
#include <GL/wglext.h>
#ifdef _MSC_VER
#pragma comment(lib, "OpenGL32.lib")
@ -31,7 +31,7 @@
#endif
#include <OpenGL/gl.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include "glext.h"
#include <GL/glext.h>
#endif
#elif defined(_IRR_COMPILE_WITH_SDL_DEVICE_) && !defined(_IRR_COMPILE_WITH_X11_DEVICE_)
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
@ -41,10 +41,8 @@
#define GL_GLEXT_PROTOTYPES 1
#define GLX_GLXEXT_PROTOTYPES 1
#endif
#define NO_SDL_GLEXT
#include <SDL/SDL_video.h>
#include <SDL/SDL_opengl.h>
#include "glext.h"
#else
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#define GL_GLEXT_LEGACY 1
@ -56,9 +54,8 @@
#include <GL/gl.h>
#include <GL/glx.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#include "glext.h"
#undef GLX_ARB_get_proc_address
#include "glxext.h"
#include <GL/glext.h>
#include <GL/glxext.h>
#endif
#endif

View File

@ -1887,8 +1887,6 @@ void COpenGLDriver::draw2DRectangle(const core::rect<s32>& position,
void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
const core::position2d<s32>& end, SColor color)
{
// TODO: It's not pixel-exact. Reason is the way OpenGL handles line-drawing (search the web for "diamond exit rule").
if (start==end)
drawPixel(start.X, start.Y, color);
else
@ -1923,6 +1921,9 @@ void COpenGLDriver::draw2DLine(const core::position2d<s32>& start,
}
glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, Quad2DIndices);
// Draw non-drawn last pixel (search for "diamond exit rule")
glDrawArrays(GL_POINTS, 1, 1);
}
}
@ -3239,6 +3240,13 @@ void COpenGLDriver::setViewPort(const core::rect<s32>& area)
}
void COpenGLDriver::setViewPortRaw(u32 width, u32 height)
{
CacheHandler->setViewport(0, 0, width, height);
ViewPort = core::recti(0, 0, width, height);
}
//! Draws a shadow volume into the stencil buffer. To draw a stencil shadow, do
//! this: First, draw all geometry. Then use this method, to draw the shadow
//! volume. Next use IVideoDriver::drawStencilShadow() to visualize the shadow.
@ -3871,7 +3879,7 @@ bool COpenGLDriver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SCol
destRenderTargetSize = renderTarget->getSize();
CacheHandler->setViewport(0, 0, destRenderTargetSize.Width, destRenderTargetSize.Height);
setViewPortRaw(destRenderTargetSize.Width, destRenderTargetSize.Height);
}
else
{
@ -3897,7 +3905,7 @@ bool COpenGLDriver::setRenderTargetEx(IRenderTarget* target, u16 clearFlag, SCol
destRenderTargetSize = core::dimension2d<u32>(0, 0);
CacheHandler->setViewport(0, 0, ScreenSize.Width, ScreenSize.Height);
setViewPortRaw(ScreenSize.Width, ScreenSize.Height);
}
if (CurrentRenderTargetSize != destRenderTargetSize)

View File

@ -456,6 +456,9 @@ namespace video
void renderArray(const void* indexList, u32 primitiveCount,
scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType);
//! Same as `CacheHandler->setViewport`, but also sets `ViewPort`
virtual void setViewPortRaw(u32 width, u32 height);
COpenGLCacheHandler* CacheHandler;
core::stringw Name;

View File

@ -9,7 +9,7 @@
#include "os.h"
#include <GL/gl.h>
#include "wglext.h"
#include <GL/wglext.h>
#ifdef _MSC_VER
#pragma comment(lib, "OpenGL32.lib")
@ -26,6 +26,7 @@ CWGLManager::CWGLManager()
#ifdef _DEBUG
setDebugName("CWGLManager");
#endif
memset(FunctionPointers, 0, sizeof(FunctionPointers));
}
CWGLManager::~CWGLManager()
@ -206,6 +207,9 @@ bool CWGLManager::initialize(const SIrrlichtCreationParameters& params, const SE
os::Printer::log("WGL_extensions", wglExtensions);
#endif
// Without a GL context we can't call wglGetProcAddress so store this for later
FunctionPointers[0] = (void*)wglGetProcAddress("wglCreateContextAttribsARB");
#ifdef WGL_ARB_pixel_format
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
if (pixel_format_supported && wglChoosePixelFormat_ARB)
@ -400,7 +404,7 @@ bool CWGLManager::generateContext()
HGLRC hrc;
// create rendering context
#ifdef WGL_ARB_create_context
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs_ARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs_ARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)FunctionPointers[0];
if (wglCreateContextAttribs_ARB)
{
// with 3.0 all available profiles should be usable, higher versions impose restrictions

View File

@ -65,6 +65,7 @@ namespace video
s32 PixelFormat;
PIXELFORMATDESCRIPTOR pfd;
ECOLOR_FORMAT ColorFormat;
void* FunctionPointers[1];
};
}
}

View File

@ -764,6 +764,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
{
readVector3(mesh.Vertices[n].Pos);
mesh.Vertices[n].Color=0xFFFFFFFF;
mesh.Vertices[n].Normal=core::vector3df(0.0f);
}
if (!checkForTwoFollowingSemicolons())

View File

@ -6,11 +6,6 @@
#include "os.h"
// This method is used for error output from bzip2.
extern "C" void bz_internal_error(int errorCode)
{
irr::os::Printer::log("Error in bzip2 handling", irr::core::stringc(errorCode), irr::ELL_ERROR);
}
#ifdef __IRR_COMPILE_WITH_ZIP_ARCHIVE_LOADER_
@ -20,25 +15,7 @@ extern "C" void bz_internal_error(int errorCode)
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_ZLIB_
#ifndef _IRR_USE_NON_SYSTEM_ZLIB_
#include <zlib.h> // use system lib
#else
#include "zlib/zlib.h"
#endif
#ifdef _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
#include "aesGladman/fileenc.h"
#endif
#ifdef _IRR_COMPILE_WITH_BZIP2_
#ifndef _IRR_USE_NON_SYSTEM_BZLIB_
#include <bzlib.h>
#else
#include "bzip2/bzlib.h"
#endif
#endif
#ifdef _IRR_COMPILE_WITH_LZMA_
#include "lzma/LzmaDec.h"
#endif
#endif
namespace irr
@ -323,46 +300,6 @@ bool CZipReader::scanZipHeader(bool ignoreGPBits)
delete [] tmp;
}
#ifdef _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
// AES encryption
if ((entry.header.GeneralBitFlag & ZIP_FILE_ENCRYPTED) && (entry.header.CompressionMethod == 99))
{
s16 restSize = entry.header.ExtraFieldLength;
SZipFileExtraHeader extraHeader;
while (restSize)
{
File->read(&extraHeader, sizeof(extraHeader));
#ifdef __BIG_ENDIAN__
extraHeader.ID = os::Byteswap::byteswap(extraHeader.ID);
extraHeader.Size = os::Byteswap::byteswap(extraHeader.Size);
#endif
restSize -= sizeof(extraHeader);
if (extraHeader.ID==(s16)0x9901)
{
SZipFileAESExtraData data;
File->read(&data, sizeof(data));
#ifdef __BIG_ENDIAN__
data.Version = os::Byteswap::byteswap(data.Version);
data.CompressionMode = os::Byteswap::byteswap(data.CompressionMode);
#endif
restSize -= sizeof(data);
if (data.Vendor[0]=='A' && data.Vendor[1]=='E')
{
// encode values into Sig
// AE-Version | Strength | ActualMode
entry.header.Sig =
((data.Version & 0xff) << 24) |
(data.EncryptionStrength << 16) |
(data.CompressionMode);
File->seek(restSize, true);
break;
}
}
}
}
// move forward length of extra field.
else
#endif
if (entry.header.ExtraFieldLength)
File->seek(entry.header.ExtraFieldLength, true);
@ -488,24 +425,6 @@ IReadFile* CZipReader::createAndOpenFile(const io::path& filename)
return 0;
}
#ifdef _IRR_COMPILE_WITH_LZMA_
//! Used for LZMA decompression. The lib has no default memory management
namespace
{
void *SzAlloc(void *p, size_t size)
{
(void)p; // disable unused variable warnings
return malloc(size);
}
void SzFree(void *p, void *address)
{
(void)p; // disable unused variable warnings
free(address);
}
ISzAlloc lzmaAlloc = { SzAlloc, SzFree };
}
#endif
//! opens a file by index
IReadFile* CZipReader::createAndOpenFile(u32 index)
{
@ -534,83 +453,6 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
IReadFile* decrypted=0;
u8* decryptedBuf=0;
u32 decryptedSize=e.header.DataDescriptor.CompressedSize;
#ifdef _IRR_COMPILE_WITH_ZIP_ENCRYPTION_
if ((e.header.GeneralBitFlag & ZIP_FILE_ENCRYPTED) && (e.header.CompressionMethod == 99))
{
os::Printer::log("Reading encrypted file.");
u8 salt[16]={0};
const u16 saltSize = (((e.header.Sig & 0x00ff0000) >>16)+1)*4;
File->seek(e.Offset);
File->read(salt, saltSize);
char pwVerification[2];
char pwVerificationFile[2];
File->read(pwVerification, 2);
fcrypt_ctx zctx; // the encryption context
int rc = fcrypt_init(
(e.header.Sig & 0x00ff0000) >>16,
(const unsigned char*)Password.c_str(), // the password
Password.size(), // number of bytes in password
salt, // the salt
(unsigned char*)pwVerificationFile, // on return contains password verifier
&zctx); // encryption context
if (strncmp(pwVerificationFile, pwVerification, 2))
{
os::Printer::log("Wrong password");
return 0;
}
decryptedSize= e.header.DataDescriptor.CompressedSize-saltSize-12;
decryptedBuf= new u8[decryptedSize];
u32 c = 0;
while ((c+32768)<=decryptedSize)
{
File->read(decryptedBuf+c, 32768);
fcrypt_decrypt(
decryptedBuf+c, // pointer to the data to decrypt
32768, // how many bytes to decrypt
&zctx); // decryption context
c+=32768;
}
File->read(decryptedBuf+c, decryptedSize-c);
fcrypt_decrypt(
decryptedBuf+c, // pointer to the data to decrypt
decryptedSize-c, // how many bytes to decrypt
&zctx); // decryption context
char fileMAC[10];
char resMAC[10];
rc = fcrypt_end(
(unsigned char*)resMAC, // on return contains the authentication code
&zctx); // encryption context
if (rc != 10)
{
os::Printer::log("Error on encryption closing");
delete [] decryptedBuf;
return 0;
}
File->read(fileMAC, 10);
if (strncmp(fileMAC, resMAC, 10))
{
os::Printer::log("Error on encryption check");
delete [] decryptedBuf;
return 0;
}
decrypted = FileSystem->createMemoryReadFile(decryptedBuf, decryptedSize, Files[index].FullName, true);
actualCompressionMethod = (e.header.Sig & 0xffff);
#if 0
if ((e.header.Sig & 0xff000000)==0x01000000)
{
}
else if ((e.header.Sig & 0xff000000)==0x02000000)
{
}
else
{
os::Printer::log("Unknown encryption method");
return 0;
}
#endif
}
#endif
switch(actualCompressionMethod)
{
case 0: // no compression
@ -696,139 +538,13 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
}
case 12:
{
#ifdef _IRR_COMPILE_WITH_BZIP2_
const u32 uncompressedSize = e.header.DataDescriptor.UncompressedSize;
c8* pBuf = new c8[ uncompressedSize ];
if (!pBuf)
{
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", core::stringw(Files[index].FullName).c_str() );
os::Printer::log( buf, ELL_ERROR);
if (decrypted)
decrypted->drop();
return 0;
}
u8 *pcData = decryptedBuf;
if (!pcData)
{
pcData = new u8[decryptedSize];
if (!pcData)
{
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", core::stringw(Files[index].FullName).c_str() );
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf;
return 0;
}
//memset(pcData, 0, decryptedSize);
File->seek(e.Offset);
File->read(pcData, decryptedSize);
}
bz_stream bz_ctx;
memset(&bz_ctx, 0, sizeof(bz_ctx));
/* use BZIP2's default memory allocation
bz_ctx->bzalloc = NULL;
bz_ctx->bzfree = NULL;
bz_ctx->opaque = NULL;
*/
int err = BZ2_bzDecompressInit(&bz_ctx, 0, 0); /* decompression */
if(err != BZ_OK)
{
os::Printer::log("bzip2 decompression failed. File cannot be read.", ELL_ERROR);
return 0;
}
bz_ctx.next_in = (char*)pcData;
bz_ctx.avail_in = decryptedSize;
/* pass all input to decompressor */
bz_ctx.next_out = pBuf;
bz_ctx.avail_out = uncompressedSize;
err = BZ2_bzDecompress(&bz_ctx);
err = BZ2_bzDecompressEnd(&bz_ctx);
if (decrypted)
decrypted->drop();
else
delete[] pcData;
if (err != BZ_OK)
{
swprintf_irr ( buf, 64, L"Error decompressing %s", core::stringw(Files[index].FullName).c_str() );
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf;
return 0;
}
else
return FileSystem->createMemoryReadFile(pBuf, uncompressedSize, Files[index].FullName, true);
#else
os::Printer::log("bzip2 decompression not supported. File cannot be read.", ELL_ERROR);
return 0;
#endif
}
case 14:
{
#ifdef _IRR_COMPILE_WITH_LZMA_
u32 uncompressedSize = e.header.DataDescriptor.UncompressedSize;
c8* pBuf = new c8[ uncompressedSize ];
if (!pBuf)
{
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", core::stringw(Files[index].FullName).c_str() );
os::Printer::log( buf, ELL_ERROR);
if (decrypted)
decrypted->drop();
return 0;
}
u8 *pcData = decryptedBuf;
if (!pcData)
{
pcData = new u8[decryptedSize];
if (!pcData)
{
swprintf_irr ( buf, 64, L"Not enough memory for decompressing %s", core::stringw(Files[index].FullName).c_str() );
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf;
return 0;
}
//memset(pcData, 0, decryptedSize);
File->seek(e.Offset);
File->read(pcData, decryptedSize);
}
ELzmaStatus status;
SizeT tmpDstSize = uncompressedSize;
SizeT tmpSrcSize = decryptedSize;
unsigned int propSize = (pcData[3]<<8)+pcData[2];
int err = LzmaDecode((Byte*)pBuf, &tmpDstSize,
pcData+4+propSize, &tmpSrcSize,
pcData+4, propSize,
e.header.GeneralBitFlag&0x1?LZMA_FINISH_END:LZMA_FINISH_ANY, &status,
&lzmaAlloc);
uncompressedSize = tmpDstSize; // may be different to expected value
if (decrypted)
decrypted->drop();
else
delete[] pcData;
if (err != SZ_OK)
{
os::Printer::log( "Error decompressing", Files[index].FullName, ELL_ERROR);
delete [] pBuf;
return 0;
}
else
return FileSystem->createMemoryReadFile(pBuf, uncompressedSize, Files[index].FullName, true);
#else
os::Printer::log("lzma decompression not supported. File cannot be read.", ELL_ERROR);
return 0;
#endif
}
case 99:
// If we come here with an encrypted file, decryption support is missing

File diff suppressed because it is too large Load Diff

View File

@ -1,348 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for Irrlicht" Description="Code analysis rules for Irrlicht15.0.vcxproj." ToolsVersion="15.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1000" Action="None" />
<Rule Id="CA1001" Action="None" />
<Rule Id="CA1002" Action="None" />
<Rule Id="CA1003" Action="None" />
<Rule Id="CA1004" Action="None" />
<Rule Id="CA1005" Action="None" />
<Rule Id="CA1006" Action="None" />
<Rule Id="CA1007" Action="None" />
<Rule Id="CA1008" Action="None" />
<Rule Id="CA1009" Action="None" />
<Rule Id="CA1010" Action="None" />
<Rule Id="CA1011" Action="None" />
<Rule Id="CA1012" Action="None" />
<Rule Id="CA1013" Action="None" />
<Rule Id="CA1014" Action="None" />
<Rule Id="CA1016" Action="None" />
<Rule Id="CA1017" Action="None" />
<Rule Id="CA1018" Action="None" />
<Rule Id="CA1019" Action="None" />
<Rule Id="CA1020" Action="None" />
<Rule Id="CA1021" Action="None" />
<Rule Id="CA1023" Action="None" />
<Rule Id="CA1024" Action="None" />
<Rule Id="CA1025" Action="None" />
<Rule Id="CA1026" Action="None" />
<Rule Id="CA1027" Action="None" />
<Rule Id="CA1028" Action="None" />
<Rule Id="CA1030" Action="None" />
<Rule Id="CA1031" Action="None" />
<Rule Id="CA1032" Action="None" />
<Rule Id="CA1033" Action="None" />
<Rule Id="CA1034" Action="None" />
<Rule Id="CA1035" Action="None" />
<Rule Id="CA1036" Action="None" />
<Rule Id="CA1038" Action="None" />
<Rule Id="CA1039" Action="None" />
<Rule Id="CA1040" Action="None" />
<Rule Id="CA1041" Action="None" />
<Rule Id="CA1043" Action="None" />
<Rule Id="CA1044" Action="None" />
<Rule Id="CA1045" Action="None" />
<Rule Id="CA1046" Action="None" />
<Rule Id="CA1047" Action="None" />
<Rule Id="CA1048" Action="None" />
<Rule Id="CA1049" Action="None" />
<Rule Id="CA1050" Action="None" />
<Rule Id="CA1051" Action="None" />
<Rule Id="CA1052" Action="None" />
<Rule Id="CA1053" Action="None" />
<Rule Id="CA1054" Action="None" />
<Rule Id="CA1055" Action="None" />
<Rule Id="CA1056" Action="None" />
<Rule Id="CA1057" Action="None" />
<Rule Id="CA1058" Action="None" />
<Rule Id="CA1059" Action="None" />
<Rule Id="CA1060" Action="None" />
<Rule Id="CA1061" Action="None" />
<Rule Id="CA1062" Action="None" />
<Rule Id="CA1063" Action="None" />
<Rule Id="CA1064" Action="None" />
<Rule Id="CA1065" Action="None" />
<Rule Id="CA1300" Action="None" />
<Rule Id="CA1301" Action="None" />
<Rule Id="CA1302" Action="None" />
<Rule Id="CA1303" Action="None" />
<Rule Id="CA1304" Action="None" />
<Rule Id="CA1305" Action="None" />
<Rule Id="CA1306" Action="None" />
<Rule Id="CA1307" Action="None" />
<Rule Id="CA1308" Action="None" />
<Rule Id="CA1309" Action="None" />
<Rule Id="CA1400" Action="None" />
<Rule Id="CA1401" Action="None" />
<Rule Id="CA1402" Action="None" />
<Rule Id="CA1403" Action="None" />
<Rule Id="CA1404" Action="None" />
<Rule Id="CA1405" Action="None" />
<Rule Id="CA1406" Action="None" />
<Rule Id="CA1407" Action="None" />
<Rule Id="CA1408" Action="None" />
<Rule Id="CA1409" Action="None" />
<Rule Id="CA1410" Action="None" />
<Rule Id="CA1411" Action="None" />
<Rule Id="CA1412" Action="None" />
<Rule Id="CA1413" Action="None" />
<Rule Id="CA1414" Action="None" />
<Rule Id="CA1415" Action="None" />
<Rule Id="CA1500" Action="None" />
<Rule Id="CA1501" Action="None" />
<Rule Id="CA1502" Action="None" />
<Rule Id="CA1504" Action="None" />
<Rule Id="CA1505" Action="None" />
<Rule Id="CA1506" Action="None" />
<Rule Id="CA1600" Action="None" />
<Rule Id="CA1601" Action="None" />
<Rule Id="CA1700" Action="None" />
<Rule Id="CA1701" Action="None" />
<Rule Id="CA1702" Action="None" />
<Rule Id="CA1703" Action="None" />
<Rule Id="CA1704" Action="None" />
<Rule Id="CA1707" Action="None" />
<Rule Id="CA1708" Action="None" />
<Rule Id="CA1709" Action="None" />
<Rule Id="CA1710" Action="None" />
<Rule Id="CA1711" Action="None" />
<Rule Id="CA1712" Action="None" />
<Rule Id="CA1713" Action="None" />
<Rule Id="CA1714" Action="None" />
<Rule Id="CA1715" Action="None" />
<Rule Id="CA1716" Action="None" />
<Rule Id="CA1717" Action="None" />
<Rule Id="CA1719" Action="None" />
<Rule Id="CA1720" Action="None" />
<Rule Id="CA1721" Action="None" />
<Rule Id="CA1722" Action="None" />
<Rule Id="CA1724" Action="None" />
<Rule Id="CA1725" Action="None" />
<Rule Id="CA1726" Action="None" />
<Rule Id="CA1800" Action="None" />
<Rule Id="CA1801" Action="None" />
<Rule Id="CA1802" Action="None" />
<Rule Id="CA1804" Action="None" />
<Rule Id="CA1806" Action="None" />
<Rule Id="CA1809" Action="None" />
<Rule Id="CA1810" Action="None" />
<Rule Id="CA1811" Action="None" />
<Rule Id="CA1812" Action="None" />
<Rule Id="CA1813" Action="None" />
<Rule Id="CA1814" Action="None" />
<Rule Id="CA1815" Action="None" />
<Rule Id="CA1816" Action="None" />
<Rule Id="CA1819" Action="None" />
<Rule Id="CA1820" Action="None" />
<Rule Id="CA1821" Action="None" />
<Rule Id="CA1822" Action="None" />
<Rule Id="CA1823" Action="None" />
<Rule Id="CA1824" Action="None" />
<Rule Id="CA1900" Action="None" />
<Rule Id="CA1901" Action="None" />
<Rule Id="CA1903" Action="None" />
<Rule Id="CA2000" Action="None" />
<Rule Id="CA2001" Action="None" />
<Rule Id="CA2002" Action="None" />
<Rule Id="CA2003" Action="None" />
<Rule Id="CA2004" Action="None" />
<Rule Id="CA2006" Action="None" />
<Rule Id="CA2100" Action="None" />
<Rule Id="CA2101" Action="None" />
<Rule Id="CA2102" Action="None" />
<Rule Id="CA2103" Action="None" />
<Rule Id="CA2104" Action="None" />
<Rule Id="CA2105" Action="None" />
<Rule Id="CA2106" Action="None" />
<Rule Id="CA2107" Action="None" />
<Rule Id="CA2108" Action="None" />
<Rule Id="CA2109" Action="None" />
<Rule Id="CA2111" Action="None" />
<Rule Id="CA2112" Action="None" />
<Rule Id="CA2114" Action="None" />
<Rule Id="CA2115" Action="None" />
<Rule Id="CA2116" Action="None" />
<Rule Id="CA2117" Action="None" />
<Rule Id="CA2118" Action="None" />
<Rule Id="CA2119" Action="None" />
<Rule Id="CA2120" Action="None" />
<Rule Id="CA2121" Action="None" />
<Rule Id="CA2122" Action="None" />
<Rule Id="CA2123" Action="None" />
<Rule Id="CA2124" Action="None" />
<Rule Id="CA2126" Action="None" />
<Rule Id="CA2130" Action="None" />
<Rule Id="CA2131" Action="None" />
<Rule Id="CA2132" Action="None" />
<Rule Id="CA2133" Action="None" />
<Rule Id="CA2134" Action="None" />
<Rule Id="CA2135" Action="None" />
<Rule Id="CA2136" Action="None" />
<Rule Id="CA2137" Action="None" />
<Rule Id="CA2138" Action="None" />
<Rule Id="CA2139" Action="None" />
<Rule Id="CA2140" Action="None" />
<Rule Id="CA2141" Action="None" />
<Rule Id="CA2142" Action="None" />
<Rule Id="CA2143" Action="None" />
<Rule Id="CA2144" Action="None" />
<Rule Id="CA2145" Action="None" />
<Rule Id="CA2146" Action="None" />
<Rule Id="CA2147" Action="None" />
<Rule Id="CA2149" Action="None" />
<Rule Id="CA2151" Action="None" />
<Rule Id="CA2200" Action="None" />
<Rule Id="CA2201" Action="None" />
<Rule Id="CA2202" Action="None" />
<Rule Id="CA2204" Action="None" />
<Rule Id="CA2205" Action="None" />
<Rule Id="CA2207" Action="None" />
<Rule Id="CA2208" Action="None" />
<Rule Id="CA2210" Action="None" />
<Rule Id="CA2211" Action="None" />
<Rule Id="CA2212" Action="None" />
<Rule Id="CA2213" Action="None" />
<Rule Id="CA2214" Action="None" />
<Rule Id="CA2215" Action="None" />
<Rule Id="CA2216" Action="None" />
<Rule Id="CA2217" Action="None" />
<Rule Id="CA2218" Action="None" />
<Rule Id="CA2219" Action="None" />
<Rule Id="CA2220" Action="None" />
<Rule Id="CA2221" Action="None" />
<Rule Id="CA2222" Action="None" />
<Rule Id="CA2223" Action="None" />
<Rule Id="CA2224" Action="None" />
<Rule Id="CA2225" Action="None" />
<Rule Id="CA2226" Action="None" />
<Rule Id="CA2227" Action="None" />
<Rule Id="CA2228" Action="None" />
<Rule Id="CA2229" Action="None" />
<Rule Id="CA2230" Action="None" />
<Rule Id="CA2231" Action="None" />
<Rule Id="CA2232" Action="None" />
<Rule Id="CA2233" Action="None" />
<Rule Id="CA2234" Action="None" />
<Rule Id="CA2235" Action="None" />
<Rule Id="CA2236" Action="None" />
<Rule Id="CA2237" Action="None" />
<Rule Id="CA2238" Action="None" />
<Rule Id="CA2239" Action="None" />
<Rule Id="CA2240" Action="None" />
<Rule Id="CA2241" Action="None" />
<Rule Id="CA2242" Action="None" />
<Rule Id="CA2243" Action="None" />
<Rule Id="CA5122" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C26400" Action="None" />
<Rule Id="C26401" Action="None" />
<Rule Id="C26402" Action="None" />
<Rule Id="C26408" Action="None" />
<Rule Id="C26409" Action="None" />
<Rule Id="C26426" Action="None" />
<Rule Id="C26429" Action="None" />
<Rule Id="C26431" Action="None" />
<Rule Id="C26432" Action="None" />
<Rule Id="C26435" Action="None" />
<Rule Id="C26438" Action="None" />
<Rule Id="C26440" Action="None" />
<Rule Id="C26443" Action="None" />
<Rule Id="C26444" Action="None" />
<Rule Id="C26445" Action="None" />
<Rule Id="C26446" Action="None" />
<Rule Id="C26447" Action="None" />
<Rule Id="C26448" Action="None" />
<Rule Id="C26449" Action="None" />
<Rule Id="C26451" Action="None" />
<Rule Id="C26455" Action="None" />
<Rule Id="C26459" Action="None" />
<Rule Id="C26461" Action="None" />
<Rule Id="C26466" Action="None" />
<Rule Id="C26472" Action="None" />
<Rule Id="C26477" Action="None" />
<Rule Id="C26481" Action="None" />
<Rule Id="C26482" Action="None" />
<Rule Id="C26485" Action="None" />
<Rule Id="C26486" Action="None" />
<Rule Id="C26489" Action="None" />
<Rule Id="C26491" Action="None" />
<Rule Id="C26493" Action="None" />
<Rule Id="C26494" Action="Warning" />
<Rule Id="C26495" Action="None" />
<Rule Id="C26496" Action="Warning" />
<Rule Id="C26497" Action="None" />
<Rule Id="C28204" Action="None" />
<Rule Id="C28205" Action="None" />
<Rule Id="C28209" Action="None" />
<Rule Id="C28210" Action="None" />
<Rule Id="C28211" Action="None" />
<Rule Id="C28212" Action="None" />
<Rule Id="C28213" Action="None" />
<Rule Id="C28214" Action="None" />
<Rule Id="C28215" Action="None" />
<Rule Id="C28216" Action="None" />
<Rule Id="C28217" Action="None" />
<Rule Id="C28218" Action="None" />
<Rule Id="C28219" Action="None" />
<Rule Id="C28220" Action="None" />
<Rule Id="C28221" Action="None" />
<Rule Id="C28222" Action="None" />
<Rule Id="C28223" Action="None" />
<Rule Id="C28224" Action="None" />
<Rule Id="C28225" Action="None" />
<Rule Id="C28226" Action="None" />
<Rule Id="C28227" Action="None" />
<Rule Id="C28228" Action="None" />
<Rule Id="C28229" Action="None" />
<Rule Id="C28230" Action="None" />
<Rule Id="C28231" Action="None" />
<Rule Id="C28232" Action="None" />
<Rule Id="C28233" Action="None" />
<Rule Id="C28234" Action="None" />
<Rule Id="C28235" Action="None" />
<Rule Id="C28236" Action="None" />
<Rule Id="C28237" Action="None" />
<Rule Id="C28238" Action="None" />
<Rule Id="C28239" Action="None" />
<Rule Id="C28240" Action="None" />
<Rule Id="C28241" Action="None" />
<Rule Id="C28243" Action="None" />
<Rule Id="C28244" Action="None" />
<Rule Id="C28245" Action="None" />
<Rule Id="C28246" Action="None" />
<Rule Id="C28250" Action="None" />
<Rule Id="C28251" Action="None" />
<Rule Id="C28252" Action="None" />
<Rule Id="C28253" Action="None" />
<Rule Id="C28254" Action="None" />
<Rule Id="C28260" Action="None" />
<Rule Id="C28262" Action="None" />
<Rule Id="C28263" Action="None" />
<Rule Id="C28266" Action="None" />
<Rule Id="C28267" Action="None" />
<Rule Id="C28272" Action="None" />
<Rule Id="C28273" Action="None" />
<Rule Id="C28285" Action="None" />
<Rule Id="C28286" Action="None" />
<Rule Id="C28287" Action="None" />
<Rule Id="C28288" Action="None" />
<Rule Id="C28289" Action="None" />
<Rule Id="C28290" Action="None" />
<Rule Id="C28291" Action="None" />
<Rule Id="C28300" Action="None" />
<Rule Id="C28301" Action="None" />
<Rule Id="C28302" Action="None" />
<Rule Id="C28303" Action="None" />
<Rule Id="C28304" Action="None" />
<Rule Id="C28305" Action="None" />
<Rule Id="C28306" Action="None" />
<Rule Id="C28307" Action="None" />
<Rule Id="C28308" Action="None" />
<Rule Id="C28309" Action="None" />
<Rule Id="C28350" Action="None" />
<Rule Id="C28351" Action="None" />
<Rule Id="C6326" Action="None" />
</Rules>
</RuleSet>

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5E34C9F21B7F6E3400F212E8"
BuildableName = "libIrrlicht.a"
BlueprintName = "Irrlicht_OSX"
ReferencedContainer = "container:Irrlicht.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5E34C9F21B7F6E3400F212E8"
BuildableName = "libIrrlicht.a"
BlueprintName = "Irrlicht_OSX"
ReferencedContainer = "container:Irrlicht.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5E34C9F21B7F6E3400F212E8"
BuildableName = "libIrrlicht.a"
BlueprintName = "Irrlicht_OSX"
ReferencedContainer = "container:Irrlicht.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5E5732B11C18E212003F664E"
BuildableName = "libIrrlicht.a"
BlueprintName = "Irrlicht_iOS"
ReferencedContainer = "container:Irrlicht.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5E5732B11C18E212003F664E"
BuildableName = "libIrrlicht.a"
BlueprintName = "Irrlicht_iOS"
ReferencedContainer = "container:Irrlicht.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5E5732B11C18E212003F664E"
BuildableName = "libIrrlicht.a"
BlueprintName = "Irrlicht_iOS"
ReferencedContainer = "container:Irrlicht.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -1,50 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht10.0.vcxproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release - Fast FPU|Win32 = Release - Fast FPU|Win32
Release - Fast FPU|x64 = Release - Fast FPU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Static lib - Debug|Win32 = Static lib - Debug|Win32
Static lib - Debug|x64 = Static lib - Debug|x64
Static lib - Release - Fast FPU|Win32 = Static lib - Release - Fast FPU|Win32
Static lib - Release - Fast FPU|x64 = Static lib - Release - Fast FPU|x64
Static lib - Release|Win32 = Static lib - Release|Win32
Static lib - Release|x64 = Static lib - Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.ActiveCfg = Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.Build.0 = Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.Build.0 = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|x64.ActiveCfg = Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|x64.Build.0 = Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.ActiveCfg = Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.Build.0 = Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.ActiveCfg = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.Build.0 = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.ActiveCfg = Static lib - Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.Build.0 = Static lib - Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.Build.0 = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|x64.ActiveCfg = Static lib - Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|x64.Build.0 = Static lib - Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.ActiveCfg = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.Build.0 = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.ActiveCfg = Static lib - Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.Build.0 = Static lib - Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,50 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht11.0.vcxproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release - Fast FPU|Win32 = Release - Fast FPU|Win32
Release - Fast FPU|x64 = Release - Fast FPU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Static lib - Debug|Win32 = Static lib - Debug|Win32
Static lib - Debug|x64 = Static lib - Debug|x64
Static lib - Release - Fast FPU|Win32 = Static lib - Release - Fast FPU|Win32
Static lib - Release - Fast FPU|x64 = Static lib - Release - Fast FPU|x64
Static lib - Release|Win32 = Static lib - Release|Win32
Static lib - Release|x64 = Static lib - Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.ActiveCfg = Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.Build.0 = Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.Build.0 = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|x64.ActiveCfg = Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|x64.Build.0 = Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.ActiveCfg = Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.Build.0 = Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.ActiveCfg = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.Build.0 = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.ActiveCfg = Static lib - Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.Build.0 = Static lib - Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.Build.0 = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|x64.ActiveCfg = Static lib - Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|x64.Build.0 = Static lib - Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.ActiveCfg = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.Build.0 = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.ActiveCfg = Static lib - Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.Build.0 = Static lib - Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30501.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht12.0.vcxproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release - Fast FPU|Win32 = Release - Fast FPU|Win32
Release - Fast FPU|x64 = Release - Fast FPU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
SDL-Debug|Win32 = SDL-Debug|Win32
SDL-Debug|x64 = SDL-Debug|x64
Static lib - Debug|Win32 = Static lib - Debug|Win32
Static lib - Debug|x64 = Static lib - Debug|x64
Static lib - Release - Fast FPU|Win32 = Static lib - Release - Fast FPU|Win32
Static lib - Release - Fast FPU|x64 = Static lib - Release - Fast FPU|x64
Static lib - Release|Win32 = Static lib - Release|Win32
Static lib - Release|x64 = Static lib - Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.ActiveCfg = Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.Build.0 = Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.Build.0 = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|x64.ActiveCfg = Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|x64.Build.0 = Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.ActiveCfg = Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.Build.0 = Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|Win32.ActiveCfg = SDL-Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|Win32.Build.0 = SDL-Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|x64.ActiveCfg = SDL-Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|x64.Build.0 = SDL-Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.ActiveCfg = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.Build.0 = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.ActiveCfg = Static lib - Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.Build.0 = Static lib - Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.Build.0 = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|x64.ActiveCfg = Static lib - Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|x64.Build.0 = Static lib - Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.ActiveCfg = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.Build.0 = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.ActiveCfg = Static lib - Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.Build.0 = Static lib - Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,58 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 14.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht14.0.vcxproj", "{E08E042A-6C45-411B-92BE-3CC31331019F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release - Fast FPU|Win32 = Release - Fast FPU|Win32
Release - Fast FPU|x64 = Release - Fast FPU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
SDL-Debug|Win32 = SDL-Debug|Win32
SDL-Debug|x64 = SDL-Debug|x64
Static lib - Debug|Win32 = Static lib - Debug|Win32
Static lib - Debug|x64 = Static lib - Debug|x64
Static lib - Release - Fast FPU|Win32 = Static lib - Release - Fast FPU|Win32
Static lib - Release - Fast FPU|x64 = Static lib - Release - Fast FPU|x64
Static lib - Release|Win32 = Static lib - Release|Win32
Static lib - Release|x64 = Static lib - Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.ActiveCfg = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|Win32.Build.0 = Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.ActiveCfg = Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Debug|x64.Build.0 = Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|Win32.Build.0 = Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|x64.ActiveCfg = Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release - Fast FPU|x64.Build.0 = Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.ActiveCfg = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|Win32.Build.0 = Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.ActiveCfg = Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Release|x64.Build.0 = Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|Win32.ActiveCfg = SDL-Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|Win32.Build.0 = SDL-Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|x64.ActiveCfg = SDL-Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.SDL-Debug|x64.Build.0 = SDL-Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.ActiveCfg = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|Win32.Build.0 = Static lib - Debug|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.ActiveCfg = Static lib - Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Debug|x64.Build.0 = Static lib - Debug|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|Win32.Build.0 = Static lib - Release - Fast FPU|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|x64.ActiveCfg = Static lib - Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release - Fast FPU|x64.Build.0 = Static lib - Release - Fast FPU|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.ActiveCfg = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|Win32.Build.0 = Static lib - Release|Win32
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.ActiveCfg = Static lib - Release|x64
{E08E042A-6C45-411B-92BE-3CC31331019F}.Static lib - Release|x64.Build.0 = Static lib - Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,61 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2008
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Irrlicht", "Irrlicht15.0.vcxproj", "{DD5C43CB-34A8-409B-9010-5A5A52787552}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release - Fast FPU|Win32 = Release - Fast FPU|Win32
Release - Fast FPU|x64 = Release - Fast FPU|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
SDL-Debug|Win32 = SDL-Debug|Win32
SDL-Debug|x64 = SDL-Debug|x64
Static lib - Debug|Win32 = Static lib - Debug|Win32
Static lib - Debug|x64 = Static lib - Debug|x64
Static lib - Release - Fast FPU|Win32 = Static lib - Release - Fast FPU|Win32
Static lib - Release - Fast FPU|x64 = Static lib - Release - Fast FPU|x64
Static lib - Release|Win32 = Static lib - Release|Win32
Static lib - Release|x64 = Static lib - Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Debug|Win32.ActiveCfg = Debug|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Debug|Win32.Build.0 = Debug|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Debug|x64.ActiveCfg = Debug|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Debug|x64.Build.0 = Debug|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Release - Fast FPU|Win32.ActiveCfg = Release - Fast FPU|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Release - Fast FPU|Win32.Build.0 = Release - Fast FPU|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Release - Fast FPU|x64.ActiveCfg = Release - Fast FPU|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Release - Fast FPU|x64.Build.0 = Release - Fast FPU|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Release|Win32.ActiveCfg = Release|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Release|Win32.Build.0 = Release|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Release|x64.ActiveCfg = Release|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Release|x64.Build.0 = Release|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.SDL-Debug|Win32.ActiveCfg = SDL-Debug|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.SDL-Debug|Win32.Build.0 = SDL-Debug|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.SDL-Debug|x64.ActiveCfg = SDL-Debug|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.SDL-Debug|x64.Build.0 = SDL-Debug|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Debug|Win32.ActiveCfg = Static lib - Debug|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Debug|Win32.Build.0 = Static lib - Debug|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Debug|x64.ActiveCfg = Static lib - Debug|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Debug|x64.Build.0 = Static lib - Debug|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Release - Fast FPU|Win32.ActiveCfg = Static lib - Release - Fast FPU|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Release - Fast FPU|Win32.Build.0 = Static lib - Release - Fast FPU|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Release - Fast FPU|x64.ActiveCfg = Static lib - Release - Fast FPU|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Release - Fast FPU|x64.Build.0 = Static lib - Release - Fast FPU|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Release|Win32.ActiveCfg = Static lib - Release|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Release|Win32.Build.0 = Static lib - Release|Win32
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Release|x64.ActiveCfg = Static lib - Release|x64
{DD5C43CB-34A8-409B-9010-5A5A52787552}.Static lib - Release|x64.Build.0 = Static lib - Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DF9BEF31-A6F9-42FD-9573-28F994828B0B}
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,248 +0,0 @@
VERSION_MAJOR = 1
VERSION_MINOR = 9
VERSION_RELEASE = 0
# Irrlicht Engine 1.9.0
# Makefile for Linux
#
# To use, just run:
#
# make
#
# This will compile Irrlicht, create a static lib (libIrrlicht.a), and copy it
# into the subdirectory lib/Linux. That's all.
#
# If you want Irrlicht to be compiled as shared lib (libIrrlicht.so.versionnumber), then run:
#
# make sharedlib
# make install
#
# If you want to compile in release mode run:
#
# make NDEBUG=1
#
# For cross-compilation for Win32 under Linux, just use the win32 targets. You have to set
# at least CXX, CC, and AR to the proper binaries.
#
# For compiling on MinGW you can run it with:
#
# make win32
#
# Or as MinGW by default has CC set to cc - but has no compiler by that name - you might have to do:
# make CC=gcc win32
#List of object files, separated based on engine architecture
IRRMESHLOADER = CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMY3DMeshFileLoader.o COCTLoader.o CXMeshFileLoader.o CIrrMeshFileLoader.o CSTLMeshFileLoader.o CLWOMeshFileLoader.o CPLYMeshFileLoader.o CSMFMeshFileLoader.o CMeshTextureLoader.o
IRRMESHWRITER = CColladaMeshWriter.o CIrrMeshWriter.o CSTLMeshWriter.o COBJMeshWriter.o CPLYMeshWriter.o CB3DMeshWriter.o
IRRMESHOBJ = $(IRRMESHLOADER) $(IRRMESHWRITER) \
CSkinnedMesh.o CBoneSceneNode.o CMeshSceneNode.o \
CAnimatedMeshSceneNode.o CAnimatedMeshMD2.o CAnimatedMeshMD3.o \
CQ3LevelMesh.o CQuake3ShaderSceneNode.o CAnimatedMeshHalfLife.o
IRROBJ = CBillboardSceneNode.o CCameraSceneNode.o CDummyTransformationSceneNode.o CEmptySceneNode.o CGeometryCreator.o CLightSceneNode.o CMeshManipulator.o CMetaTriangleSelector.o COctreeSceneNode.o COctreeTriangleSelector.o CSceneCollisionManager.o CSceneManager.o CShadowVolumeSceneNode.o CSkyBoxSceneNode.o CSkyDomeSceneNode.o CTerrainSceneNode.o CTerrainTriangleSelector.o CVolumeLightSceneNode.o CCubeSceneNode.o CSphereSceneNode.o CTextSceneNode.o CTriangleBBSelector.o CTriangleSelector.o CWaterSurfaceSceneNode.o CMeshCache.o CDefaultSceneNodeAnimatorFactory.o CDefaultSceneNodeFactory.o CSceneLoaderIrr.o
IRRPARTICLEOBJ = CParticleAnimatedMeshSceneNodeEmitter.o CParticleBoxEmitter.o CParticleCylinderEmitter.o CParticleMeshEmitter.o CParticlePointEmitter.o CParticleRingEmitter.o CParticleSphereEmitter.o CParticleAttractionAffector.o CParticleFadeOutAffector.o CParticleGravityAffector.o CParticleRotationAffector.o CParticleSystemSceneNode.o CParticleScaleAffector.o
IRRANIMOBJ = CSceneNodeAnimatorCameraFPS.o CSceneNodeAnimatorCameraMaya.o CSceneNodeAnimatorCollisionResponse.o CSceneNodeAnimatorDelete.o CSceneNodeAnimatorFlyCircle.o CSceneNodeAnimatorFlyStraight.o CSceneNodeAnimatorFollowSpline.o CSceneNodeAnimatorRotation.o CSceneNodeAnimatorTexture.o
IRRDRVROBJ = CNullDriver.o COpenGLCacheHandler.o COpenGLDriver.o COpenGLNormalMapRenderer.o COpenGLParallaxMapRenderer.o COpenGLShaderMaterialRenderer.o COpenGLSLMaterialRenderer.o COpenGLExtensionHandler.o \
CD3D9Driver.o CD3D9HLSLMaterialRenderer.o CD3D9NormalMapRenderer.o CD3D9ParallaxMapRenderer.o CD3D9ShaderMaterialRenderer.o CD3D9Texture.o \
COGLESDriver.o COGLESExtensionHandler.o COGLES2Driver.o COGLES2ExtensionHandler.o COGLES2FixedPipelineRenderer.o COGLES2MaterialRenderer.o COGLES2NormalMapRenderer.o COGLES2ParallaxMapRenderer.o COGLES2Renderer2D.o CWebGL1Driver.o \
CGLXManager.o CWGLManager.o CEGLManager.o
IRRIMAGEOBJ = CColorConverter.o CImage.o CImageLoaderBMP.o CImageLoaderDDS.o CImageLoaderJPG.o CImageLoaderPCX.o CImageLoaderPNG.o CImageLoaderPSD.o CImageLoaderPVR.o CImageLoaderTGA.o CImageLoaderPPM.o CImageLoaderWAL.o CImageLoaderRGB.o \
CImageWriterBMP.o CImageWriterJPG.o CImageWriterPCX.o CImageWriterPNG.o CImageWriterPPM.o CImageWriterPSD.o CImageWriterTGA.o
IRRVIDEOOBJ = CVideoModeList.o CFPSCounter.o $(IRRDRVROBJ) $(IRRIMAGEOBJ)
IRRSWRENDEROBJ = CSoftwareDriver.o CSoftwareTexture.o CTRFlat.o CTRFlatWire.o CTRGouraud.o CTRGouraudWire.o CTRNormalMap.o \
CTRStencilShadow.o CTRTextureFlat.o CTRTextureFlatWire.o CTRTextureGouraud.o CTRTextureGouraudAdd.o CTRTextureGouraudNoZ.o \
CTRTextureGouraudWire.o CZBuffer.o CTRTextureGouraudVertexAlpha2.o CTRTextureGouraudNoZ2.o CTRTextureLightMap2_M2.o \
CTRTextureLightMap2_M4.o CTRTextureLightMap2_M1.o CSoftwareDriver2.o CSoftwareTexture2.o CTRTextureGouraud2.o CTRGouraud2.o \
CTRGouraudAlpha2.o CTRGouraudAlphaNoZ2.o CTRTextureDetailMap2.o CTRTextureGouraudAdd2.o CTRTextureGouraudAddNoZ2.o CTRTextureWire2.o \
CTRTextureLightMap2_Add.o CTRTextureLightMapGouraud2_M4.o IBurningShader.o CTRTextureBlend.o CTRTextureGouraudAlpha.o \
CTRTextureGouraudAlphaNoZ.o CDepthBuffer.o CBurningShader_Raster_Reference.o CTR_transparent_reflection_2_layer.o CTRGouraudNoZ2.o burning_shader_color.o
IRRIOOBJ = CFileList.o CFileSystem.o CLimitReadFile.o CMemoryFile.o CReadFile.o CWriteFile.o CXMLReader.o CXMLWriter.o CWADReader.o CZipReader.o CPakReader.o CNPKReader.o CTarReader.o CMountPointReader.o irrXML.o CAttributes.o lzma/LzmaDec.o
IRROTHEROBJ = CIrrDeviceSDL.o CIrrDeviceLinux.o CIrrDeviceConsole.o CIrrDeviceStub.o CIrrDeviceWin32.o CIrrDeviceFB.o CLogger.o COSOperator.o Irrlicht.o os.o leakHunter.o CProfiler.o utf8.o
IRRGUIOBJ = CGUIButton.o CGUICheckBox.o CGUIComboBox.o CGUIContextMenu.o CGUIEditBox.o CGUIEnvironment.o CGUIFileOpenDialog.o CGUIFont.o CGUIImage.o CGUIInOutFader.o CGUIListBox.o CGUIMenu.o CGUIMeshViewer.o CGUIMessageBox.o CGUIModalScreen.o CGUIScrollBar.o CGUISpinBox.o CGUISkin.o CGUIStaticText.o CGUITabControl.o CGUITable.o CGUIToolBar.o CGUIWindow.o CGUIColorSelectDialog.o CDefaultGUIElementFactory.o CGUISpriteBank.o CGUIImageList.o CGUITreeView.o CGUIProfiler.o
ZLIBOBJ = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/uncompr.o zlib/zutil.o
JPEGLIBOBJ = jpeglib/jcapimin.o jpeglib/jcapistd.o jpeglib/jccoefct.o jpeglib/jccolor.o jpeglib/jcdctmgr.o jpeglib/jchuff.o jpeglib/jcinit.o jpeglib/jcmainct.o jpeglib/jcmarker.o jpeglib/jcmaster.o jpeglib/jcomapi.o jpeglib/jcparam.o jpeglib/jcprepct.o jpeglib/jcsample.o jpeglib/jctrans.o jpeglib/jdapimin.o jpeglib/jdapistd.o jpeglib/jdatadst.o jpeglib/jdatasrc.o jpeglib/jdcoefct.o jpeglib/jdcolor.o jpeglib/jddctmgr.o jpeglib/jdhuff.o jpeglib/jdinput.o jpeglib/jdmainct.o jpeglib/jdmarker.o jpeglib/jdmaster.o jpeglib/jdmerge.o jpeglib/jdpostct.o jpeglib/jdsample.o jpeglib/jdtrans.o jpeglib/jerror.o jpeglib/jfdctflt.o jpeglib/jfdctfst.o jpeglib/jfdctint.o jpeglib/jidctflt.o jpeglib/jidctfst.o jpeglib/jidctint.o jpeglib/jmemmgr.o jpeglib/jmemnobs.o jpeglib/jquant1.o jpeglib/jquant2.o jpeglib/jutils.o jpeglib/jcarith.o jpeglib/jdarith.o jpeglib/jaricom.o
LIBPNGOBJ = libpng/png.o libpng/pngerror.o libpng/pngget.o libpng/pngmem.o libpng/pngpread.o libpng/pngread.o libpng/pngrio.o libpng/pngrtran.o libpng/pngrutil.o libpng/pngset.o libpng/pngtrans.o libpng/pngwio.o libpng/pngwrite.o libpng/pngwtran.o libpng/pngwutil.o
LIBAESGM = aesGladman/aescrypt.o aesGladman/aeskey.o aesGladman/aestab.o aesGladman/fileenc.o aesGladman/hmac.o aesGladman/prng.o aesGladman/pwd2key.o aesGladman/sha1.o aesGladman/sha2.o
BZIP2OBJ = bzip2/blocksort.o bzip2/huffman.o bzip2/crctable.o bzip2/randtable.o bzip2/bzcompress.o bzip2/decompress.o bzip2/bzlib.o
# Next variable is for additional scene nodes etc. of customized Irrlicht versions
EXTRAOBJ =
LINKOBJ = $(IRRMESHOBJ) $(IRROBJ) $(IRRPARTICLEOBJ) $(IRRANIMOBJ) \
$(IRRVIDEOOBJ) $(IRRSWRENDEROBJ) $(IRRIOOBJ) $(IRROTHEROBJ) \
$(IRRGUIOBJ) $(ZLIBOBJ) $(JPEGLIBOBJ) $(LIBPNGOBJ) $(LIBAESGM) \
$(BZIP2OBJ) $(EXTRAOBJ)
emscripten: EMSCRIPTEN=1
###############
#Compiler flags
CXXINCS = -I../../include -Izlib -Ijpeglib -Ilibpng
CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1
CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti
#CXXFLAGS += -std=gnu++11 -U__STRICT_ANSI__
ifndef NDEBUG
CXXFLAGS += -g -D_DEBUG
else
CXXFLAGS += -O3
endif
ifdef PROFILE
CXXFLAGS += -pg
endif
ifdef EMSCRIPTEN
CXXFLAGS += -std=gnu++11 -U__STRICT_ANSI__
ifndef NDEBUG
CFLAGS := -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0
else
CFLAGS := -O3 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0
endif
ifdef WASM
CXXFLAGS += -s WASM=1
endif
else
CFLAGS := -O3 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0
endif
sharedlib sharedlib_osx: CXXFLAGS += -fPIC
sharedlib sharedlib_osx: CFLAGS += -fPIC
#multilib handling
ifeq ($(HOSTTYPE), x86_64)
LIBSELECT=64
endif
#Linux specific options
staticlib sharedlib install: SYSTEM = Linux
sharedlib install: SHARED_LIB = libIrrlicht.so
sharedlib: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm
staticlib sharedlib: CXXINCS += -I/usr/X11R6/include
#OSX specific options
staticlib_osx sharedlib_osx install_osx: SYSTEM = MacOSX
staticlib_osx sharedlib_osx: IRROTHEROBJ += MacOSX/CIrrDeviceMacOSX.o MacOSX/OSXClipboard.o MacOSX/AppDelegate.o
staticlib_osx sharedlib_osx: CXXINCS += -IMacOSX -I/usr/X11R6/include
sharedlib_osx install_osx: SHARED_LIB = libIrrlicht.dylib
staticlib_osx sharedlib_osx: LDFLAGS += --no-export-all-symbols --add-stdcall-alias
sharedlib_osx: LDFLAGS += -L/usr/X11R6/lib$(LIBSELECT) -lGL -lXxf86vm
# for non-X11 app
#sharedlib_osx: LDFLAGS += -framework cocoa -framework carbon -framework opengl -framework IOKit
#Windows specific options
IRRLICHT_DLL := ../../bin/Win32-gcc/Irrlicht.dll
sharedlib_win32 staticlib_win32: SYSTEM = Win32-gcc
sharedlib_win32: LDFLAGS += -lgdi32 -lopengl32 -ld3dx9d -lwinmm -Wl,--add-stdcall-alias
#sharedlib_win32: LDFLAGS += -lSDL
#choose either -DIRR_COMPILE_WITH_DX9_DEV_PACK or -DNO_IRR_COMPILE_WITH_DIRECT3D_9_ depending if you need dx9
#sharedlib_win32 staticlib_win32: CPPFLAGS += -DIRR_COMPILE_WITH_DX9_DEV_PACK
sharedlib_win32 staticlib_win32: CPPFLAGS += -DNO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ -DNO_IRR_COMPILE_WITH_DIRECT3D_9_
staticlib_win32: CPPFLAGS += -D_IRR_STATIC_LIB_
#emscripten specific options
staticlib_emscripten: SYSTEM = emscripten
# You might want to disable features you don't need in Irrlicht here to reduce Irrlicht library.
# This can also help to reduce the .js size when compiling for emscripten.
# Note you can also disable the same features by modifying IrrCompileConfig.h which is slightly
# safer as you have then the same setting when compiling Irrlicht and your project (but needs
# modifying source-code while you can simply copy the Makefile and create your own settings)
# xml - use a lot, but also takes a lot of space. Check if you have any formats using it.s
#CXXFLAGS += -DNO_IRR_COMPILE_WITH_XML_
# Get rid of encrypted zip files or bzip encrypted zip's or lzma encrypte zip's - or even all zip-file support.
#CXXFLAGS += -DNO_IRR_COMPILE_WITH_ZIP_ENCRYPTION_ -DNO_IRR_COMPILE_WITH_BZIP2_ -DNO_IRR_COMPILE_WITH_LZMA_ -DNO_IRR_COMPILE_WITH_ZLIB_
# Disable mesh writers
#CXXFLAGS += -DNO_IRR_COMPILE_WITH_IRR_WRITER_ -DNO_IRR_COMPILE_WITH_COLLADA_WRITER_ -DNO_IRR_COMPILE_WITH_STL_WRITER_
#CXXFLAGS += -DNO_IRR_COMPILE_WITH_OBJ_WRITER_ -DNO_IRR_COMPILE_WITH_PLY_WRITER_ -DNO_IRR_COMPILE_WITH_B3D_WRITER_
# Disable image writers
#CXXFLAGS += -DNO_IRR_COMPILE_WITH_BMP_WRITER_ -DNO_IRR_COMPILE_WITH_JPG_WRITER_ -DNO_IRR_COMPILE_WITH_PCX_WRITER_
#CXXFLAGS += -DNO_IRR_COMPILE_WITH_PNG_WRITER_ -DNO_IRR_COMPILE_WITH_PPM_WRITER_ -DNO_IRR_COMPILE_WITH_TGA_WRITER_
STATIC_LIB = libIrrlicht.a
LIB_PATH = ../../lib/$(SYSTEM)
INSTALL_DIR = /usr/local/lib
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
SHARED_FULLNAME = $(SHARED_LIB).$(VERSION)
SONAME = $(SHARED_LIB).$(VERSION_MAJOR).$(VERSION_MINOR)
####################
# All target, builds Irrlicht as static lib (libIrrlicht.a) and copies it into lib/Linux
all linux : staticlib
emscripten: staticlib_emscripten
# Builds Irrlicht as shared lib (libIrrlicht.so.versionNumber) and copies it into lib/Linux
sharedlib: $(LINKOBJ)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -Wl,-soname,$(SONAME) -o $(SHARED_FULLNAME) $^ $(LDFLAGS)
mkdir -p $(LIB_PATH)
cp $(SHARED_FULLNAME) $(LIB_PATH)
# Builds Irrlicht as static lib (libIrrlicht.a)
$(STATIC_LIB): $(LINKOBJ)
$(AR) rs $@ $^
# Copies static lib into ../../lib/($SYSTEM)
staticlib staticlib_osx staticlib_emscripten: $(STATIC_LIB)
mkdir -p $(LIB_PATH)
cp $^ $(LIB_PATH)
# Builds Irrlicht as dll (Irrlicht.dll) into ../../bin/Win32-gcc
all_win32 win32: sharedlib_win32
sharedlib_win32: $(IRRLICHT_DLL)
../../bin/Win32-gcc/Irrlicht.dll: $(LINKOBJ)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -shared -o $@ $^ $(LDFLAGS) -Wl,--out-implib,../../lib/Win32-gcc/$(STATIC_LIB)
# Copies static lib into /lib/Win32-gcc
staticlib_win32: $(STATIC_LIB)
cp $^ $(LIB_PATH)
# Builds Irrlicht as shared lib (libIrrlicht.so.versionNumber) and copies it into /lib/MacOSX
sharedlib_osx: $(LINKOBJ)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -dynamiclib -Wl,-install_name,$(SONAME) -o $(SHARED_FULLNAME) $^ $(LDFLAGS)
cp $(SHARED_FULLNAME) $(LIB_PATH)
# Installs Irrlicht if it was created as shared lib
install install_osx:
$(RM) -r $(INSTALL_DIR)/../include/irrlicht
mkdir -p $(INSTALL_DIR)/../include/irrlicht
cp ../../include/*.h $(INSTALL_DIR)/../include/irrlicht/
cp $(LIB_PATH)/$(SHARED_FULLNAME) $(INSTALL_DIR)
cd $(INSTALL_DIR) && ln -s -f $(SHARED_FULLNAME) $(SONAME)
cd $(INSTALL_DIR) && ln -s -f $(SONAME) $(SHARED_LIB)
# ldconfig -n $(INSTALL_DIR)
TAGS:
ctags *.cpp ../../include/*.h *.h
# Create dependency files for automatic recompilation
%.d:%.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MM -MF $@ $<
# Create dependency files for automatic recompilation
%.d:%.c
$(CC) $(CPPFLAGS) $(CFLAGS) -MM -MF $@ $<
# Create object files from objective-c code
%.o:%.mm
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
ifneq ($(MAKECMDGOALS),clean)
-include $(LINKOBJ:.o=.d)
endif
help:
@echo "Available targets for Irrlicht"
@echo " sharedlib: Build shared library Irrlicht.so for Linux"
@echo " staticlib: Build static library Irrlicht.a for Linux"
@echo " emscripten: Build static emscripen library on Linux"
@echo " install: Copy shared library to /usr/local/lib"
@echo ""
@echo " sharedlib_win32: Build shared library Irrlicht.dll for Windows"
@echo " staticlib_win32: Build static library Irrlicht.a for Windows"
@echo ""
@echo " clean: Clean up directory"
# Cleans all temporary files and compilation results.
clean:
$(RM) $(LINKOBJ) $(SHARED_FULLNAME) $(STATIC_LIB) $(LINKOBJ:.o=.d)
.PHONY: all sharedlib staticlib sharedlib_win32 staticlib_win32 emscripten staticlib_emscripten help install clean

View File

@ -1,403 +0,0 @@
# -*- coding: utf-8 -*-
import os, re, subprocess, tempfile, zipfile
import SCons.Errors
# === function for build environment object =========================================================================
# creating a resource file for suppress long-line-error
# @param env environment object
# @param sources list files (should be absoute path names)
def ResourceFile(env, list) :
(fd, resource) = tempfile.mkstemp(".res", text=True)
for i in list :
os.write (fd, "%s\n" % str(i).replace("\\", "\\\\"))
os.close(fd)
return env.get("TEMPFILEPREFIX", "") + resource
def zipbetter(target, source, env):
compression = env.get('ZIPCOMPRESSION', 0)
zf = zipfile.ZipFile(str(target[0]), 'w', compression)
for s in source:
if s.isdir():
for dirpath, dirnames, filenames in os.walk(str(s)):
for fname in filenames:
path = os.path.join(dirpath, fname)
if os.path.isfile(path):
zf.write(path, os.path.relpath(path, env.get("ZIPROOT", "")))
else:
zf.write(str(s), os.path.relpath(str(s), env.get("ZIPROOT", "")))
zf.close()
# creates the global build object
# @return build object
def createEnvironment() :
directxdir = ""
if "DXSDK_DIR" in os.environ :
directxdir = os.environ["DXSDK_DIR"]
vars = Variables()
vars.Add(PathVariable("installdir", "install directory for the library", os.path.join("bin"), PathVariable.PathIsDirCreate))
vars.Add(EnumVariable("buildtarget", "type of the library", "shared", allowed_values=("shared", "static")))
vars.Add(EnumVariable("buildtype", "name of target build type", "release", allowed_values=("debug", "release")))
vars.Add(EnumVariable("platform", "build platform", "", allowed_values=("", "linux", "osx-library", "osx-framework", "win32-mingw", "win32-msvc", "win64-msvc")))
vars.Add(BoolVariable("package", "creates of the compiled library a package (header & binary) as a zip file", False))
vars.Add(BoolVariable("opengl", "build with Open GL support", True))
vars.Add(PathVariable("directxsdk", "directory of the Direct X SDK (joystick support is disabled by default)", directxdir, PathVariable.PathAccept))
# set the correct build toolkit (and a own process spawn)
env = Environment(tools = [], variables=vars)
Help(vars.GenerateHelpText(env))
env["ResourceFile"] = ResourceFile
if env["package"] :
zipbetter_bld = Builder(action = zipbetter, target_factory = SCons.Node.FS.default_fs.Entry, source_factory = SCons.Node.FS.default_fs.Entry)
env.Append(BUILDERS = {'ZipBetter' : zipbetter_bld})
if env["platform"] in ["linux", "osx-library", "osx-framework"] :
env.Tool("default")
elif env["platform"] in ["win32-msvc", "win64-mvc"] :
env.Tool("msvc")
env.Tool("mslink")
env.Tool("msvs")
env.Tool("mssdk")
elif env["platform"] in ["win32-mingw", "win64-mingw"] :
env.Tool("mingw")
else :
raise SCons.Errors.StopError("platform is not set")
# check parameter
if env["buildtarget"] == "static" and env["platform"] == "osx-framework" :
raise SCons.Errors.StopError("static library can not be build with the an osx framework")
if env["buildtype"] == "debug" and env["platform"] == "osx-framework" :
raise SCons.Errors.StopError("debug library can not be build with the an osx framework")
# set constants and global values (directory names are relative to the SConstruct)
# read first Irrlicht SDK version from the file include/IrrCompileConfig.h
irrlichtversion = None
try :
configfile = open( os.path.join("include", "IrrCompileConfig.h"), "r" )
irrlichtversion = re.search("#define(.*)IRRLICHT_SDK_VERSION(.*)", configfile.read())
configfile.close()
except :
pass
if irrlichtversion == None :
raise SCons.Errors.StopError("can not find Irrlicht SDK version in the configuration header")
env["irr_libversion"] = irrlichtversion.group(2).replace("\"", "").strip()
env["irr_libinstallname"] = "Irrlicht"
env["irr_osxframeworkname"] = env["irr_libinstallname"]
env["irr_srcexamples"] = "examples"
env["irr_srclibrary"] = os.path.join("source", "Irrlicht")
if env["buildtype"] == "debug" :
env["irr_libinstallname"] = env["irr_libinstallname"] + "Debug"
if "CXX" in os.environ :
env.Replace(CXX = os.environ["CXX"])
if "CC" in os.environ :
env.Replace(CC = os.environ["CC"])
if "CPPPATH" in os.environ :
env.AppendUnique(CPPPATH = os.environ["CPPPATH"].split(os.pathsep))
if "CXXFLAGS" in os.environ :
env.AppendUnique(CXXFLAGS = os.environ["CXXFLAGS"].split(" "))
if "LIBRARY_PATH" in os.environ :
env.AppendUnique(CIBPATH = os.environ["LIBRARY_PATH"].split(os.pathsep))
if "LDFLAGS" in os.environ :
env.AppendUnique(LINKFLAGS = os.environ["LDFLAGS"].split(" "))
return env
# creates a build object for the library,
# and sets the platform specific build data
# @param env build object
# @return cloned build object with library specific data
def getLibraryBuildEnvironment(env) :
envlib = env.Clone()
# define global options
envlib.AppendUnique(CPPPATH = ["include", envlib["irr_srclibrary"], os.path.join(envlib["irr_srclibrary"], "zlib"), os.path.join(envlib["irr_srclibrary"], "jpeglib"), os.path.join(envlib["irr_srclibrary"], "libpng")])
envlib.AppendUnique(CPPDEFINES = ["IRRLICHT_EXPORTS"])
if envlib["buildtype"] == "debug" :
envlib.AppendUnique(CPPDEFINES = ["_DEBUG"])
# define platform specific options
if envlib["platform"] in ["osx-library", "osx-framework"] :
libname = envlib["LIBPREFIX"] + envlib["irr_libinstallname"] + "." + envlib["irr_libversion"] + envlib["SHLIBSUFFIX"]
envlib.AppendUnique(CPPPATH = [os.path.join(envlib["irr_srclibrary"], "MacOSX")])
envlib.AppendUnique(LINKFLAGS = ["-Wl,-framework,Cocoa", "-Wl,-framework,IOKit", "-Wl,-install_name,"+libname])
if envlib["buildtype"] == "debug" :
envlib.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
elif envlib["buildtype"] == "release" :
envlib.AppendUnique(CXXFLAGS = ["-O3", "-fexpensive-optimizations"])
configOpenGL(envlib)
envlib.AppendUnique(CFLAGS = envlib["CXXFLAGS"])
elif envlib["platform"] == "linux" :
libname = envlib["LIBPREFIX"] + envlib["irr_libinstallname"] + envlib["SHLIBSUFFIX"] + "." + envlib["irr_libversion"]
envlib.AppendUnique(LIBS = ["Xxf86vm"])
envlib.AppendUnique(LINKFLAGS = ["-Wl,--soname="+libname])
if envlib["buildtype"] == "debug" :
envlib.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
elif envlib["buildtype"] == "release" :
envlib.AppendUnique(CXXFLAGS = ["-O3", "-fexpensive-optimizations"])
configOpenGL(envlib)
envlib.AppendUnique(CFLAGS = envlib["CXXFLAGS"])
elif envlib["platform"] in ["win32-mingw", "win64-mingw"] :
# for suppress the too-long-line error, we use a temporary file on the linker source list
envlib["SHLINKCOM"] = "$SHLINK -o $TARGET $SHLINKFLAGS ${ResourceFile(__env__, SOURCES.abspath)} $_LIBDIRFLAGS $_LIBFLAGS"
envlib["ARCOM"] = "$AR $ARFLAGS $TARGET ${ResourceFile(__env__, SOURCES.abspath)}"
# on MinGW we create a DLL, which can be used by other toolchains (we need the std-alias, the kill-flag and the out-implib option)
envlib.AppendUnique(LINKFLAGS = ["-Wl,--add-stdcall-alias", "-Wl,--kill-at", "-Wl,--out-implib,"+envlib["LIBPREFIX"]+env["irr_libinstallname"]+envlib["LIBSUFFIX"]])
envlib.AppendUnique(LIBS = ["winmm", "gdi32"])
if envlib["buildtype"] == "debug" :
envlib.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
elif envlib["buildtype"] == "release" :
envlib.AppendUnique(CXXFLAGS = ["-O3", "-fexpensive-optimizations"])
configOpenGL(envlib)
configDirectX(envlib)
envlib.AppendUnique(CFLAGS = envlib["CXXFLAGS"])
elif envlib["platform"] in ["win32-msvc", "win64-msvc"] :
envlib.AppendUnique(CXXFLAGS = ["/analyze", "/Gd", "/GF", "/GR-", "/GS", "/Gy", "/Zl"])
envlib.AppendUnique(LINKFLAGS = ["/VERSION:\""+envlib["irr_libversion"]+"\"", "/nologo"])
envlib.AppendUnique(LIBS = ["gdi32.lib", "user32.lib", "advapi32.lib"])
if envlib["buildtype"] == "debug" :
envlib.AppendUnique(CXXFLAGS = ["-Wall", "/MTd", "/RTC1", "/Zi"])
elif envlib["buildtype"] == "release" :
envlib.AppendUnique(CXXFLAGS = ["/GL", "/MT", "/Ox"])
envlib.AppendUnique(LINKFLAGS = ["/SUBSYSTEM:WINDOWS", "/OPT:REF", "/LTCG"])
configOpenGL(envlib)
configDirectX(envlib)
return envlib
# define Open GL support (OSX needs always the OpenGL framework)
# @param library environment
def configOpenGL(envlib) :
if not envlib["opengl"] :
envlib.AppendUnique(CPPDEFINES = ["NO_IRR_COMPILE_WITH_OPENGL_"])
if envlib["platform"] in ["osx-library", "osx-framework"] :
envlib.AppendUnique(LINKFLAGS = ["-Wl,-framework,OpenGL"])
elif envlib["opengl"] and envlib["platform"] == "linux" :
envlib.AppendUnique(LIBS = ["GL"])
elif envlib["opengl"] and envlib["platform"] in ["win32-mingw", "win64-mingw", "win32-msvc", "win64-msvc"] :
envlib.AppendUnique(LIBS = ["opengl32"])
# define Direct X 9 support ( Direct X 8 is disabled by the SDK )
# @param library environment
def configDirectX(envlib) :
envlib.AppendUnique(CPPDEFINES = ["NO_IRR_COMPILE_WITH_DIRECT3D_8_", "NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_"])
if os.path.exists(env["directxsdk"]) :
envlib.AppendUnique(CPPPATH = [os.path.join(envlib["directxsdk"], "Include")])
envlib.AppendUnique(CPPDEFINES = ["IRR_COMPILE_WITH_DX9_DEV_PACK"])
envlib.AppendUnique(LIBS = ["d3dx9"])
if "win32" in envlib["platform"] :
envlib.AppendUnique(LIBPATH = [os.path.join(envlib["directxsdk"], "Lib", "x86")])
elif "win64" in envlib["platform"] :
envlib.AppendUnique(LIBPATH = [os.path.join(envlib["directxsdk"], "Lib", "x84")])
else :
envlib.AppendUnique(CPPDEFINES = ["NO_IRR_COMPILE_WITH_DIRECT3D_9_"])
# creates a build object for the examples,
# and sets the platform specific build data
# @param env build object
# @return cloned build object with example specific data
def getExampleBuildEnvironment(env) :
envexamples = env.Clone()
if envexamples["buildtype"] == "debug" :
envexamples.AppendUnique(CPPDEFINES = ["_DEBUG"])
# define platform specific data
if envexamples["platform"] in ["osx-library", "osx-framework"] :
if envexamples["buildtype"] == "debug" :
envexamples.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
elif envexamples["buildtype"] == "release" :
envexamples.AppendUnique(CXXFLAGS = ["-O3"])
if envexamples["platform"] == "osx-framework" :
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "Irrlicht.framework", "Headers")])
envexamples.AppendUnique(LINKFLAGS = ["-Wl,-framework,Irrlicht", "-Wl,-F"+env["installdir"]])
else :
if envexamples["buildtype"] == "debug" :
envexamples.AppendUnique(LIBS = ["IrrlichtDebug"])
elif envexamples["buildtype"] == "release" :
envexamples.AppendUnique(LIBS = ["Irrlicht"])
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "include")])
envexamples.AppendUnique(LIBPATH = [os.path.join(env["installdir"], "lib")])
elif envexamples["platform"] == "linux" :
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "include")])
envexamples.AppendUnique(LIBPATH = [os.path.join(env["installdir"], "lib")])
if envexamples["buildtype"] == "debug" :
envexamples.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
envexamples.AppendUnique(LIBS = ["IrrlichtDebug"])
elif envexamples["buildtype"] == "release" :
envexamples.AppendUnique(CXXFLAGS = ["-O3"])
envexamples.AppendUnique(LIBS = ["Irrlicht"])
elif envexamples["platform"] in ["win32-mingw", "win64-mingw"] :
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "include")])
envexamples.AppendUnique(LIBPATH = [os.path.join(env["installdir"], "lib")])
envexamples.AppendUnique(LIBS = ["Irrlicht", "gdi32", "opengl32"])
if envexamples["buildtype"] == "debug" :
envexamples.AppendUnique(CXXFLAGS = ["-Wall", "-g"])
envexamples.AppendUnique(LIBS = ["IrrlichtDebug"])
elif envexamples["buildtype"] == "release" :
envexamples.AppendUnique(CXXFLAGS = ["-O3"])
envexamples.AppendUnique(LIBS = ["Irrlicht"])
elif envexamples["platform"] in ["win32-msvc", "win64-msvc"] :
envexamples.AppendUnique(CPPPATH = [os.path.join(env["installdir"], "include")])
envexamples.AppendUnique(LIBPATH = [os.path.join(env["installdir"], "lib")])
envexamples.AppendUnique(LINKFLAGS = ["/nologo"])
envexamples.AppendUnique(CXXFLAGS = ["/analyze", "/Gd", "/GF", "/GR-", "/GS", "/Gy"])
envexamples.AppendUnique(LIBS = [ "user32", "gdi32", "opengl32"])
if envexamples["buildtype"] == "debug" :
envexamples.AppendUnique(CXXFLAGS = ["-Wall", "/MTd", "/RTC1", "/Zi"])
envexamples.AppendUnique(LIBS = ["IrrlichtDebug"])
elif envexamples["buildtype"] == "release" :
envexamples.AppendUnique(CXXFLAGS = ["/GL", "/MT", "/Ox"])
envexamples.AppendUnique(LINKFLAGS = ["/SUBSYSTEM:CONSOLE", "/OPT:REF", "/LTCG"])
envexamples.AppendUnique(LIBS = ["Irrlicht"])
return envexamples
# runs the installation process
# @param env environment object
# @param lib build library object
# @param header headerfile list
def installLibrary(env, lib, header) :
install = []
if lib and type(lib) == type([]) :
lib = lib[0]
libname = str(lib).replace("']", "").replace("['", "")
if env["platform"] in ["linux", "osx-library"] :
if env["platform"] == "osx-library" :
versionname = libname.replace(env["SHLIBSUFFIX"], "") + "." + env["irr_libversion"] + env["SHLIBSUFFIX"]
elif env["platform"] == "linux" :
versionname = libname + "." + env["irr_libversion"]
install.append(env.Install( os.path.join(env["installdir"], "lib"), lib ))
for i in header :
install.append(env.Command( os.path.join(env["installdir"], "include", os.path.basename(str(i))), i, Copy("$TARGET", "$SOURCE")))
if env["buildtarget"] == "shared" :
install.append( env.Command(os.path.join(env["installdir"], "lib", versionname), os.path.basename(libname), "ln -s $SOURCE $TARGET") )
elif env["platform"] == "osx-framework" :
framework = os.path.join(env["installdir"], env["irr_osxframeworkname"]+".framework")
data = []
data.append(env.Install( os.path.join(framework, "Versions", env["irr_libversion"], "Libraries"), lib ))
for i in header :
data.append(env.Command( os.path.join(framework, "Versions", env["irr_libversion"], "Headers", os.path.basename(str(i))), i, Copy("$TARGET", "$SOURCE")))
# remove existing links and create new ones
install.append( env.Command(os.path.join(framework, "Irrlicht"), data, "rm -f $TARGET && ln -s "+os.path.join("Versions", env["irr_libversion"], "Libraries", os.path.basename(libname))+" $TARGET") )
install.append( env.Command(os.path.join(framework, "Libraries"), data, "rm -f $TARGET && ln -s "+os.path.join("Versions", env["irr_libversion"], "Libraries")+" $TARGET") )
install.append( env.Command(os.path.join(framework, "Headers"), data, "rm -f $TARGET && ln -s "+os.path.join("Versions", env["irr_libversion"], "Headers")+" $TARGET") )
install.append( env.Command(os.path.join(framework, "Versions", "Current"), data, "rm -f $TARGET && ln -s "+os.path.join(env["irr_libversion"])+" $TARGET") )
elif env["platform"] in ["win32-mingw", "win64-mingw", "win32-msvc", "win64-msvc"] :
install.append(env.Install( os.path.join(env["installdir"], "lib"), lib ))
for i in header :
install.append(env.Command( os.path.join(env["installdir"], "include", os.path.basename(str(i))), i, Copy("$TARGET", "$SOURCE")))
# create a package
if env["package"] :
nameparts = [env["platform"], env["buildtarget"], env["irr_libversion"], env["buildtype"]]
install = env.ZipBetter( os.path.join("bin", "irrlicht-"+"-".join(nameparts)+env['ZIPSUFFIX']), install, ZIPROOT=env["installdir"])
NoClean(install)
Default(install)
# ===================================================================================================================
# ===================================================================================================================
# === create build commands =========================================================================================
env = createEnvironment()
envlib = getLibraryBuildEnvironment(env)
envexamples = getExampleBuildEnvironment(env)
# === set the sources (we use similar structure of the Makefile) ====================================================
# get all header files (for later installation)
headers = Glob(os.path.join("include", "*.h"))
# library sources (libjpeg & bzip2 added manually, because not all files are needed)
libjpeg = [ os.path.join(env["irr_srclibrary"], "jpeglib", i) for i in ["jcapimin.c", "jcapistd.c", "jccoefct.c", "jccolor.c", "jcdctmgr.c", "jchuff.c", "jcinit.c", "jcmainct.c", "jcmarker.c", "jcmaster.c", "jcomapi.c", "jcparam.c", "jcprepct.c", "jcsample.c", "jctrans.c", "jdapimin.c", "jdapistd.c", "jdatadst.c", "jdatasrc.c", "jdcoefct.c", "jdcolor.c", "jddctmgr.c", "jdhuff.c", "jdinput.c", "jdmainct.c", "jdmarker.c", "jdmaster.c", "jdmerge.c", "jdpostct.c", "jdsample.c", "jdtrans.c", "jerror.c", "jfdctflt.c", "jfdctfst.c", "jfdctint.c", "jidctflt.c", "jidctfst.c", "jidctint.c", "jmemmgr.c", "jmemnobs.c", "jquant1.c", "jquant2.c", "jutils.c", "jcarith.c", "jdarith.c", "jaricom.c"] ]
libbzip2 = [ os.path.join(env["irr_srclibrary"], "bzip2", i) for i in ["blocksort.c", "huffman.c", "crctable.c", "randtable.c", "bzcompress.c", "decompress.c", "bzlib.c"] ]
srclibrary = Glob(os.path.join(env["irr_srclibrary"], "*.cpp")) + Glob(os.path.join(env["irr_srclibrary"], "libpng", "*.c")) + Glob(os.path.join(env["irr_srclibrary"], "lzma", "*.c")) + Glob(os.path.join(env["irr_srclibrary"], "zlib", "*.c")) + Glob(os.path.join(env["irr_srclibrary"], "aesGladman", "*.cpp")) + libjpeg + libbzip2
if "osx" in env["platform"] :
srclibrary.extend(Glob(os.path.join(envlib["irr_srclibrary"], "MacOSX", "*.mm")))
# sources of the examples
srcexamples = ["01.HelloWorld", "02.Quake3Map", "03.CustomSceneNode", "04.Movement", "05.UserInterface", "06.2DGraphics", "07.Collision", "08.SpecialFX", "09.Meshviewer", "10.Shaders", "11.PerPixelLighting", "12.TerrainRendering", "13.RenderToTexture", "15.LoadIrrFile", "16.Quake3MapShader", "17.HelloWorld_Mobile", "18.SplitScreen", "19.MouseAndJoystick", "20.ManagedLights", "22.MaterialViewer", "23.SMeshHandling", "24.CursorControl", "25.XmlHandling", "26.OcclusionQuery", "30.Profiling"]
if "win" in env["platform"] :
srcexamples.append("14.Win32Window")
# ===================================================================================================================
# === build and install =============================================================================================
if env["buildtarget"] == "shared" :
lib = envlib.SharedLibrary(env["irr_libinstallname"], srclibrary)
elif env["buildtarget"] == "static" :
lib = envlib.StaticLibrary(env["irr_libinstallname"], srclibrary)
# build examples
examples = []
for i in srcexamples :
examples.append( envexamples.Program( os.path.join("bin", "examples-"+envlib["platform"], i.replace(".", "_")), os.path.join(env["irr_srcexamples"], i, "main.cpp")) )
installLibrary(env, lib, headers)
NoClean(examples)
Alias("examples", examples)

View File

@ -1,25 +0,0 @@
A File Encryption Utility - VC++ 7.1 project Instructions
1. Unzip the enclosed files into a suitable VC++ project directory.
2. Obtain the bzip2 source code from http://sources.redhat.com/bzip2/
and unzip the files into the bzip2 sub-directory.
3. Compile the bzip2 project to give a static library
4. Compile the encfile project.
5. The executable encfile.exe is now ready for use:
enfile password filename
If the filename does not have the extension 'enc', it is assumed to
be a normal file that will then be encrypted to a file with the same
name but with an added extension 'enc'.
If the filename has the extension 'enc' its is assumed to be an
encrypted file that will be decrypted to a file with the same name
but without the 'enc' extension.
The default HASH function is SHA1, which is set up by defining USE_SHA1 in
compiling the project. If USE_SHA256 is defined instead then SHA256 is used.
Brian Gladman

View File

@ -1,137 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2003, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 26/08/2003
This file contains the definitions required to use AES in C. See aesopt.h
for optimisation details.
*/
#ifndef _AES_H
#define _AES_H
#include "irrMath.h"
#define AES_128 /* define if AES with 128 bit keys is needed */
#define AES_192 /* define if AES with 192 bit keys is needed */
#define AES_256 /* define if AES with 256 bit keys is needed */
#define AES_VAR /* define if a variable key size is needed */
/* The following must also be set in assembler files if being used */
#define AES_ENCRYPT /* if support for encryption is needed */
#define AES_DECRYPT /* if support for decryption is needed */
#define AES_ERR_CHK /* for parameter checks & error return codes */
typedef irr::u8 aes_08t;
typedef irr::u32 aes_32t;
#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */
#define N_COLS 4 /* the number of columns in the state */
/* a maximum of 60 32-bit words are needed for the key schedule */
#define KS_LENGTH 64
#ifdef AES_ERR_CHK
#define aes_ret int
#define aes_good 0
#define aes_error -1
#else
#define aes_ret void
#endif
#ifndef AES_DLL /* implement normal/DLL functions */
#define aes_rval aes_ret
#else
#define aes_rval aes_ret __declspec(dllexport) _stdcall
#endif
/* This routine must be called before first use if non-static */
/* tables are being used */
void gen_tabs(void);
/* The key length (klen) is input in bytes when it is in the range */
/* 16 <= klen <= 32 or in bits when in the range 128 <= klen <= 256 */
#ifdef AES_ENCRYPT
typedef struct
{
aes_32t ks[KS_LENGTH];
} aes_encrypt_ctx;
#if defined(AES_128) || defined(AES_VAR)
aes_rval aes_encrypt_key128(const void *in_key, aes_encrypt_ctx cx[1]);
#endif
#if defined(AES_192) || defined(AES_VAR)
aes_rval aes_encrypt_key192(const void *in_key, aes_encrypt_ctx cx[1]);
#endif
#if defined(AES_256) || defined(AES_VAR)
aes_rval aes_encrypt_key256(const void *in_key, aes_encrypt_ctx cx[1]);
#endif
#if defined(AES_VAR)
aes_rval aes_encrypt_key(const void *in_key, int key_len, aes_encrypt_ctx cx[1]);
#endif
aes_rval aes_encrypt(const void *in_blk, void *out_blk, const aes_encrypt_ctx cx[1]);
#endif
#ifdef AES_DECRYPT
typedef struct
{
aes_32t ks[KS_LENGTH];
} aes_decrypt_ctx;
#if defined(AES_128) || defined(AES_VAR)
aes_rval aes_decrypt_key128(const void *in_key, aes_decrypt_ctx cx[1]);
#endif
#if defined(AES_192) || defined(AES_VAR)
aes_rval aes_decrypt_key192(const void *in_key, aes_decrypt_ctx cx[1]);
#endif
#if defined(AES_256) || defined(AES_VAR)
aes_rval aes_decrypt_key256(const void *in_key, aes_decrypt_ctx cx[1]);
#endif
#if defined(AES_VAR)
aes_rval aes_decrypt_key(const void *in_key, int key_len, aes_decrypt_ctx cx[1]);
#endif
aes_rval aes_decrypt(const void *in_blk, void *out_blk, const aes_decrypt_ctx cx[1]);
#endif
#endif

View File

@ -1,307 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2003, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 26/08/2003
This file contains the code for implementing encryption and decryption
for AES (Rijndael) for block and key sizes of 16, 24 and 32 bytes. It
can optionally be replaced by code written in assembler using NASM. For
further details see the file aesopt.h
*/
#include "aesopt.h"
#define si(y,x,k,c) (s(y,c) = word_in(x, c) ^ (k)[c])
#define so(y,x,c) word_out(y, c, s(x,c))
#if defined(ARRAYS)
#define locals(y,x) x[4],y[4]
#else
#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3
#endif
#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \
s(y,2) = s(x,2); s(y,3) = s(x,3);
#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3)
#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3)
#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3)
#if defined(ENCRYPTION) && !defined(AES_ASM)
/* Visual C++ .Net v7.1 provides the fastest encryption code when using
Pentium optimization with small code but this is poor for decryption
so we need to control this with the following VC++ pragmas
*/
#if defined(_MSC_VER)
#pragma optimize( "s", on )
#endif
/* Given the column (c) of the output state variable, the following
macros give the input state variables which are needed in its
computation for each row (r) of the state. All the alternative
macros give the same end values but expand into different ways
of calculating these values. In particular the complex macro
used for dynamically variable block sizes is designed to expand
to a compile time constant whenever possible but will expand to
conditional clauses on some branches (I am grateful to Frank
Yellin for this construction)
*/
#define fwd_var(x,r,c)\
( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\
: r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\
: r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\
: ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2)))
#if defined(FT4_SET)
#undef dec_fmvars
#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c))
#elif defined(FT1_SET)
#undef dec_fmvars
#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(f,n),fwd_var,rf1,c))
#else
#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ fwd_mcol(no_table(x,t_use(s,box),fwd_var,rf1,c)))
#endif
#if defined(FL4_SET)
#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,l),fwd_var,rf1,c))
#elif defined(FL1_SET)
#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(f,l),fwd_var,rf1,c))
#else
#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(s,box),fwd_var,rf1,c))
#endif
aes_rval aes_encrypt(const void *in_blk, void *out_blk, const aes_encrypt_ctx cx[1])
{ aes_32t locals(b0, b1);
const aes_32t *kp = cx->ks;
#ifdef dec_fmvars
dec_fmvars; /* declare variables for fwd_mcol() if needed */
#endif
aes_32t nr = (kp[45] ^ kp[52] ^ kp[53] ? kp[52] : 14);
#ifdef AES_ERR_CHK
if( (nr != 10 || !(kp[0] | kp[3] | kp[4]))
&& (nr != 12 || !(kp[0] | kp[5] | kp[6]))
&& (nr != 14 || !(kp[0] | kp[7] | kp[8])) )
return aes_error;
#endif
state_in(b0, in_blk, kp);
#if (ENC_UNROLL == FULL)
switch(nr)
{
case 14:
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
kp += 2 * N_COLS;
/* Falls through. */
case 12:
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
kp += 2 * N_COLS;
/* Falls through. */
case 10:
round(fwd_rnd, b1, b0, kp + 1 * N_COLS);
round(fwd_rnd, b0, b1, kp + 2 * N_COLS);
round(fwd_rnd, b1, b0, kp + 3 * N_COLS);
round(fwd_rnd, b0, b1, kp + 4 * N_COLS);
round(fwd_rnd, b1, b0, kp + 5 * N_COLS);
round(fwd_rnd, b0, b1, kp + 6 * N_COLS);
round(fwd_rnd, b1, b0, kp + 7 * N_COLS);
round(fwd_rnd, b0, b1, kp + 8 * N_COLS);
round(fwd_rnd, b1, b0, kp + 9 * N_COLS);
round(fwd_lrnd, b0, b1, kp +10 * N_COLS);
}
#else
#if (ENC_UNROLL == PARTIAL)
{ aes_32t rnd;
for(rnd = 0; rnd < (nr >> 1) - 1; ++rnd)
{
kp += N_COLS;
round(fwd_rnd, b1, b0, kp);
kp += N_COLS;
round(fwd_rnd, b0, b1, kp);
}
kp += N_COLS;
round(fwd_rnd, b1, b0, kp);
#else
{ aes_32t rnd;
for(rnd = 0; rnd < nr - 1; ++rnd)
{
kp += N_COLS;
round(fwd_rnd, b1, b0, kp);
l_copy(b0, b1);
}
#endif
kp += N_COLS;
round(fwd_lrnd, b0, b1, kp);
}
#endif
state_out(out_blk, b0);
#ifdef AES_ERR_CHK
return aes_good;
#endif
}
#endif
#if defined(DECRYPTION) && !defined(AES_ASM)
/* Visual C++ .Net v7.1 provides the fastest encryption code when using
Pentium optimization with small code but this is poor for decryption
so we need to control this with the following VC++ pragmas
*/
#if defined(_MSC_VER)
#pragma optimize( "t", on )
#endif
/* Given the column (c) of the output state variable, the following
macros give the input state variables which are needed in its
computation for each row (r) of the state. All the alternative
macros give the same end values but expand into different ways
of calculating these values. In particular the complex macro
used for dynamically variable block sizes is designed to expand
to a compile time constant whenever possible but will expand to
conditional clauses on some branches (I am grateful to Frank
Yellin for this construction)
*/
#define inv_var(x,r,c)\
( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\
: r == 1 ? ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))\
: r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\
: ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0)))
#if defined(IT4_SET)
#undef dec_imvars
#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,n),inv_var,rf1,c))
#elif defined(IT1_SET)
#undef dec_imvars
#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(i,n),inv_var,rf1,c))
#else
#define inv_rnd(y,x,k,c) (s(y,c) = inv_mcol((k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c)))
#endif
#if defined(IL4_SET)
#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,l),inv_var,rf1,c))
#elif defined(IL1_SET)
#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(i,l),inv_var,rf1,c))
#else
#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c))
#endif
aes_rval aes_decrypt(const void *in_blk, void *out_blk, const aes_decrypt_ctx cx[1])
{ aes_32t locals(b0, b1);
#ifdef dec_imvars
dec_imvars; /* declare variables for inv_mcol() if needed */
#endif
aes_32t nr = (cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] ? cx->ks[52] : 14);
const aes_32t *kp = cx->ks + nr * N_COLS;
#ifdef AES_ERR_CHK
if( (nr != 10 || !(cx->ks[0] | cx->ks[3] | cx->ks[4]))
&& (nr != 12 || !(cx->ks[0] | cx->ks[5] | cx->ks[6]))
&& (nr != 14 || !(cx->ks[0] | cx->ks[7] | cx->ks[8])) )
return aes_error;
#endif
state_in(b0, in_blk, kp);
#if (DEC_UNROLL == FULL)
switch(nr)
{
case 14:
round(inv_rnd, b1, b0, kp - 1 * N_COLS);
round(inv_rnd, b0, b1, kp - 2 * N_COLS);
kp -= 2 * N_COLS;
/* Falls through. */
case 12:
round(inv_rnd, b1, b0, kp - 1 * N_COLS);
round(inv_rnd, b0, b1, kp - 2 * N_COLS);
kp -= 2 * N_COLS;
/* Falls through. */
case 10:
round(inv_rnd, b1, b0, kp - 1 * N_COLS);
round(inv_rnd, b0, b1, kp - 2 * N_COLS);
round(inv_rnd, b1, b0, kp - 3 * N_COLS);
round(inv_rnd, b0, b1, kp - 4 * N_COLS);
round(inv_rnd, b1, b0, kp - 5 * N_COLS);
round(inv_rnd, b0, b1, kp - 6 * N_COLS);
round(inv_rnd, b1, b0, kp - 7 * N_COLS);
round(inv_rnd, b0, b1, kp - 8 * N_COLS);
round(inv_rnd, b1, b0, kp - 9 * N_COLS);
round(inv_lrnd, b0, b1, kp - 10 * N_COLS);
}
#else
#if (DEC_UNROLL == PARTIAL)
{ aes_32t rnd;
for(rnd = 0; rnd < (nr >> 1) - 1; ++rnd)
{
kp -= N_COLS;
round(inv_rnd, b1, b0, kp);
kp -= N_COLS;
round(inv_rnd, b0, b1, kp);
}
kp -= N_COLS;
round(inv_rnd, b1, b0, kp);
#else
{ aes_32t rnd;
for(rnd = 0; rnd < nr - 1; ++rnd)
{
kp -= N_COLS;
round(inv_rnd, b1, b0, kp);
l_copy(b0, b1);
}
#endif
kp -= N_COLS;
round(inv_lrnd, b0, b1, kp);
}
#endif
state_out(out_blk, b0);
#ifdef AES_ERR_CHK
return aes_good;
#endif
}
#endif

View File

@ -1,461 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2003, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 26/08/2003
This file contains the code for implementing the key schedule for AES
(Rijndael) for block and key sizes of 16, 24, and 32 bytes. See aesopt.h
for further details including optimisation.
*/
#include "aesopt.h"
/* Initialise the key schedule from the user supplied key. The key
length can be specified in bytes, with legal values of 16, 24
and 32, or in bits, with legal values of 128, 192 and 256. These
values correspond with Nk values of 4, 6 and 8 respectively.
The following macros implement a single cycle in the key
schedule generation process. The number of cycles needed
for each cx->n_col and nk value is:
nk = 4 5 6 7 8
------------------------------
cx->n_col = 4 10 9 8 7 7
cx->n_col = 5 14 11 10 9 9
cx->n_col = 6 19 15 12 11 11
cx->n_col = 7 21 19 16 13 14
cx->n_col = 8 29 23 19 17 14
*/
#define ke4(k,i) \
{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
}
#define kel4(k,i) \
{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+5] = ss[1] ^= ss[0]; \
k[4*(i)+6] = ss[2] ^= ss[1]; k[4*(i)+7] = ss[3] ^= ss[2]; \
}
#define ke6(k,i) \
{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
k[6*(i)+10] = ss[4] ^= ss[3]; k[6*(i)+11] = ss[5] ^= ss[4]; \
}
#define kel6(k,i) \
{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 7] = ss[1] ^= ss[0]; \
k[6*(i)+ 8] = ss[2] ^= ss[1]; k[6*(i)+ 9] = ss[3] ^= ss[2]; \
}
#define ke8(k,i) \
{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); k[8*(i)+13] = ss[5] ^= ss[4]; \
k[8*(i)+14] = ss[6] ^= ss[5]; k[8*(i)+15] = ss[7] ^= ss[6]; \
}
#define kel8(k,i) \
{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 9] = ss[1] ^= ss[0]; \
k[8*(i)+10] = ss[2] ^= ss[1]; k[8*(i)+11] = ss[3] ^= ss[2]; \
}
#if defined(ENCRYPTION_KEY_SCHEDULE)
#if defined(AES_128) || defined(AES_VAR)
aes_rval aes_encrypt_key128(const void *in_key, aes_encrypt_ctx cx[1])
{ aes_32t ss[4];
cx->ks[0] = ss[0] = word_in(in_key, 0);
cx->ks[1] = ss[1] = word_in(in_key, 1);
cx->ks[2] = ss[2] = word_in(in_key, 2);
cx->ks[3] = ss[3] = word_in(in_key, 3);
#if ENC_UNROLL == NONE
{ aes_32t i;
for(i = 0; i < ((11 * N_COLS - 1) / 4); ++i)
ke4(cx->ks, i);
}
#else
ke4(cx->ks, 0); ke4(cx->ks, 1);
ke4(cx->ks, 2); ke4(cx->ks, 3);
ke4(cx->ks, 4); ke4(cx->ks, 5);
ke4(cx->ks, 6); ke4(cx->ks, 7);
ke4(cx->ks, 8); kel4(cx->ks, 9);
#endif
/* cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] is zero for a 256 bit */
/* key and must be non-zero for 128 and 192 bits keys */
cx->ks[53] = cx->ks[45] = 0;
cx->ks[52] = 10;
#ifdef AES_ERR_CHK
return aes_good;
#endif
}
#endif
#if defined(AES_192) || defined(AES_VAR)
aes_rval aes_encrypt_key192(const void *in_key, aes_encrypt_ctx cx[1])
{ aes_32t ss[6];
cx->ks[0] = ss[0] = word_in(in_key, 0);
cx->ks[1] = ss[1] = word_in(in_key, 1);
cx->ks[2] = ss[2] = word_in(in_key, 2);
cx->ks[3] = ss[3] = word_in(in_key, 3);
cx->ks[4] = ss[4] = word_in(in_key, 4);
cx->ks[5] = ss[5] = word_in(in_key, 5);
#if ENC_UNROLL == NONE
{ aes_32t i;
for(i = 0; i < (13 * N_COLS - 1) / 6; ++i)
ke6(cx->ks, i);
}
#else
ke6(cx->ks, 0); ke6(cx->ks, 1);
ke6(cx->ks, 2); ke6(cx->ks, 3);
ke6(cx->ks, 4); ke6(cx->ks, 5);
ke6(cx->ks, 6); kel6(cx->ks, 7);
#endif
/* cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] is zero for a 256 bit */
/* key and must be non-zero for 128 and 192 bits keys */
cx->ks[53] = cx->ks[45];
cx->ks[52] = 12;
#ifdef AES_ERR_CHK
return aes_good;
#endif
}
#endif
#if defined(AES_256) || defined(AES_VAR)
aes_rval aes_encrypt_key256(const void *in_key, aes_encrypt_ctx cx[1])
{ aes_32t ss[8];
cx->ks[0] = ss[0] = word_in(in_key, 0);
cx->ks[1] = ss[1] = word_in(in_key, 1);
cx->ks[2] = ss[2] = word_in(in_key, 2);
cx->ks[3] = ss[3] = word_in(in_key, 3);
cx->ks[4] = ss[4] = word_in(in_key, 4);
cx->ks[5] = ss[5] = word_in(in_key, 5);
cx->ks[6] = ss[6] = word_in(in_key, 6);
cx->ks[7] = ss[7] = word_in(in_key, 7);
#if ENC_UNROLL == NONE
{ aes_32t i;
for(i = 0; i < (15 * N_COLS - 1) / 8; ++i)
ke8(cx->ks, i);
}
#else
ke8(cx->ks, 0); ke8(cx->ks, 1);
ke8(cx->ks, 2); ke8(cx->ks, 3);
ke8(cx->ks, 4); ke8(cx->ks, 5);
kel8(cx->ks, 6);
#endif
#ifdef AES_ERR_CHK
return aes_good;
#endif
}
#endif
#if defined(AES_VAR)
aes_rval aes_encrypt_key(const void *in_key, int key_len, aes_encrypt_ctx cx[1])
{
switch(key_len)
{
#ifdef AES_ERR_CHK
case 16: case 128: return aes_encrypt_key128(in_key, cx);
case 24: case 192: return aes_encrypt_key192(in_key, cx);
case 32: case 256: return aes_encrypt_key256(in_key, cx);
default: return aes_error;
#else
case 16: case 128: aes_encrypt_key128(in_key, cx); return;
case 24: case 192: aes_encrypt_key192(in_key, cx); return;
case 32: case 256: aes_encrypt_key256(in_key, cx); return;
#endif
}
}
#endif
#endif
#if defined(DECRYPTION_KEY_SCHEDULE)
#if DEC_ROUND == NO_TABLES
#define ff(x) (x)
#else
#define ff(x) inv_mcol(x)
#ifdef dec_imvars
#define d_vars dec_imvars
#endif
#endif
#if 1
#define kdf4(k,i) \
{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; ss[1] = ss[1] ^ ss[3]; ss[2] = ss[2] ^ ss[3]; ss[3] = ss[3]; \
ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \
ss[4] ^= k[4*(i)]; k[4*(i)+4] = ff(ss[4]); ss[4] ^= k[4*(i)+1]; k[4*(i)+5] = ff(ss[4]); \
ss[4] ^= k[4*(i)+2]; k[4*(i)+6] = ff(ss[4]); ss[4] ^= k[4*(i)+3]; k[4*(i)+7] = ff(ss[4]); \
}
#define kd4(k,i) \
{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \
k[4*(i)+4] = ss[4] ^= k[4*(i)]; k[4*(i)+5] = ss[4] ^= k[4*(i)+1]; \
k[4*(i)+6] = ss[4] ^= k[4*(i)+2]; k[4*(i)+7] = ss[4] ^= k[4*(i)+3]; \
}
#define kdl4(k,i) \
{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \
k[4*(i)+4] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; k[4*(i)+5] = ss[1] ^ ss[3]; \
k[4*(i)+6] = ss[0]; k[4*(i)+7] = ss[1]; \
}
#else
#define kdf4(k,i) \
{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+ 4] = ff(ss[0]); ss[1] ^= ss[0]; k[4*(i)+ 5] = ff(ss[1]); \
ss[2] ^= ss[1]; k[4*(i)+ 6] = ff(ss[2]); ss[3] ^= ss[2]; k[4*(i)+ 7] = ff(ss[3]); \
}
#define kd4(k,i) \
{ ss[4] = ls_box(ss[3],3) ^ t_use(r,c)[i]; \
ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[4*(i)+ 4] = ss[4] ^= k[4*(i)]; \
ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[4] ^= k[4*(i)+ 1]; \
ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[4] ^= k[4*(i)+ 2]; \
ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[4] ^= k[4*(i)+ 3]; \
}
#define kdl4(k,i) \
{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[4*(i)+ 4] = ss[0]; ss[1] ^= ss[0]; k[4*(i)+ 5] = ss[1]; \
ss[2] ^= ss[1]; k[4*(i)+ 6] = ss[2]; ss[3] ^= ss[2]; k[4*(i)+ 7] = ss[3]; \
}
#endif
#define kdf6(k,i) \
{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 6] = ff(ss[0]); ss[1] ^= ss[0]; k[6*(i)+ 7] = ff(ss[1]); \
ss[2] ^= ss[1]; k[6*(i)+ 8] = ff(ss[2]); ss[3] ^= ss[2]; k[6*(i)+ 9] = ff(ss[3]); \
ss[4] ^= ss[3]; k[6*(i)+10] = ff(ss[4]); ss[5] ^= ss[4]; k[6*(i)+11] = ff(ss[5]); \
}
#define kd6(k,i) \
{ ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \
ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[6*(i)+ 6] = ss[6] ^= k[6*(i)]; \
ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[6] ^= k[6*(i)+ 1]; \
ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[6] ^= k[6*(i)+ 2]; \
ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[6] ^= k[6*(i)+ 3]; \
ss[4] ^= ss[3]; k[6*(i)+10] = ss[6] ^= k[6*(i)+ 4]; \
ss[5] ^= ss[4]; k[6*(i)+11] = ss[6] ^= k[6*(i)+ 5]; \
}
#define kdl6(k,i) \
{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[6*(i)+ 6] = ss[0]; ss[1] ^= ss[0]; k[6*(i)+ 7] = ss[1]; \
ss[2] ^= ss[1]; k[6*(i)+ 8] = ss[2]; ss[3] ^= ss[2]; k[6*(i)+ 9] = ss[3]; \
}
#define kdf8(k,i) \
{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 8] = ff(ss[0]); ss[1] ^= ss[0]; k[8*(i)+ 9] = ff(ss[1]); \
ss[2] ^= ss[1]; k[8*(i)+10] = ff(ss[2]); ss[3] ^= ss[2]; k[8*(i)+11] = ff(ss[3]); \
ss[4] ^= ls_box(ss[3],0); k[8*(i)+12] = ff(ss[4]); ss[5] ^= ss[4]; k[8*(i)+13] = ff(ss[5]); \
ss[6] ^= ss[5]; k[8*(i)+14] = ff(ss[6]); ss[7] ^= ss[6]; k[8*(i)+15] = ff(ss[7]); \
}
#define kd8(k,i) \
{ aes_32t g = ls_box(ss[7],3) ^ t_use(r,c)[i]; \
ss[0] ^= g; g = ff(g); k[8*(i)+ 8] = g ^= k[8*(i)]; \
ss[1] ^= ss[0]; k[8*(i)+ 9] = g ^= k[8*(i)+ 1]; \
ss[2] ^= ss[1]; k[8*(i)+10] = g ^= k[8*(i)+ 2]; \
ss[3] ^= ss[2]; k[8*(i)+11] = g ^= k[8*(i)+ 3]; \
g = ls_box(ss[3],0); \
ss[4] ^= g; g = ff(g); k[8*(i)+12] = g ^= k[8*(i)+ 4]; \
ss[5] ^= ss[4]; k[8*(i)+13] = g ^= k[8*(i)+ 5]; \
ss[6] ^= ss[5]; k[8*(i)+14] = g ^= k[8*(i)+ 6]; \
ss[7] ^= ss[6]; k[8*(i)+15] = g ^= k[8*(i)+ 7]; \
}
#define kdl8(k,i) \
{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[8*(i)+ 8] = ss[0]; ss[1] ^= ss[0]; k[8*(i)+ 9] = ss[1]; \
ss[2] ^= ss[1]; k[8*(i)+10] = ss[2]; ss[3] ^= ss[2]; k[8*(i)+11] = ss[3]; \
}
#if defined(AES_128) || defined(AES_VAR)
aes_rval aes_decrypt_key128(const void *in_key, aes_decrypt_ctx cx[1])
{ aes_32t ss[5];
#ifdef d_vars
d_vars;
#endif
cx->ks[0] = ss[0] = word_in(in_key, 0);
cx->ks[1] = ss[1] = word_in(in_key, 1);
cx->ks[2] = ss[2] = word_in(in_key, 2);
cx->ks[3] = ss[3] = word_in(in_key, 3);
#if DEC_UNROLL == NONE
{ aes_32t i;
for(i = 0; i < (11 * N_COLS - 1) / 4; ++i)
ke4(cx->ks, i);
#if !(DEC_ROUND == NO_TABLES)
for(i = N_COLS; i < 10 * N_COLS; ++i)
cx->ks[i] = inv_mcol(cx->ks[i]);
#endif
}
#else
kdf4(cx->ks, 0); kd4(cx->ks, 1);
kd4(cx->ks, 2); kd4(cx->ks, 3);
kd4(cx->ks, 4); kd4(cx->ks, 5);
kd4(cx->ks, 6); kd4(cx->ks, 7);
kd4(cx->ks, 8); kdl4(cx->ks, 9);
#endif
/* cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] is zero for a 256 bit */
/* key and must be non-zero for 128 and 192 bits keys */
cx->ks[53] = cx->ks[45] = 0;
cx->ks[52] = 10;
#ifdef AES_ERR_CHK
return aes_good;
#endif
}
#endif
#if defined(AES_192) || defined(AES_VAR)
aes_rval aes_decrypt_key192(const void *in_key, aes_decrypt_ctx cx[1])
{ aes_32t ss[7];
#ifdef d_vars
d_vars;
#endif
cx->ks[0] = ss[0] = word_in(in_key, 0);
cx->ks[1] = ss[1] = word_in(in_key, 1);
cx->ks[2] = ss[2] = word_in(in_key, 2);
cx->ks[3] = ss[3] = word_in(in_key, 3);
#if DEC_UNROLL == NONE
cx->ks[4] = ss[4] = word_in(in_key, 4);
cx->ks[5] = ss[5] = word_in(in_key, 5);
{ aes_32t i;
for(i = 0; i < (13 * N_COLS - 1) / 6; ++i)
ke6(cx->ks, i);
#if !(DEC_ROUND == NO_TABLES)
for(i = N_COLS; i < 12 * N_COLS; ++i)
cx->ks[i] = inv_mcol(cx->ks[i]);
#endif
}
#else
ss[4] = word_in(in_key, 4);
cx->ks[4] = ff(ss[4]);
ss[5] = word_in(in_key, 5);
cx->ks[5] = ff(ss[5]);
kdf6(cx->ks, 0); kd6(cx->ks, 1);
kd6(cx->ks, 2); kd6(cx->ks, 3);
kd6(cx->ks, 4); kd6(cx->ks, 5);
kd6(cx->ks, 6); kdl6(cx->ks, 7);
#endif
/* cx->ks[45] ^ cx->ks[52] ^ cx->ks[53] is zero for a 256 bit */
/* key and must be non-zero for 128 and 192 bits keys */
cx->ks[53] = cx->ks[45];
cx->ks[52] = 12;
#ifdef AES_ERR_CHK
return aes_good;
#endif
}
#endif
#if defined(AES_256) || defined(AES_VAR)
aes_rval aes_decrypt_key256(const void *in_key, aes_decrypt_ctx cx[1])
{ aes_32t ss[8];
#ifdef d_vars
d_vars;
#endif
cx->ks[0] = ss[0] = word_in(in_key, 0);
cx->ks[1] = ss[1] = word_in(in_key, 1);
cx->ks[2] = ss[2] = word_in(in_key, 2);
cx->ks[3] = ss[3] = word_in(in_key, 3);
#if DEC_UNROLL == NONE
cx->ks[4] = ss[4] = word_in(in_key, 4);
cx->ks[5] = ss[5] = word_in(in_key, 5);
cx->ks[6] = ss[6] = word_in(in_key, 6);
cx->ks[7] = ss[7] = word_in(in_key, 7);
{ aes_32t i;
for(i = 0; i < (15 * N_COLS - 1) / 8; ++i)
ke8(cx->ks, i);
#if !(DEC_ROUND == NO_TABLES)
for(i = N_COLS; i < 14 * N_COLS; ++i)
cx->ks[i] = inv_mcol(cx->ks[i]);
#endif
}
#else
ss[4] = word_in(in_key, 4);
cx->ks[4] = ff(ss[4]);
ss[5] = word_in(in_key, 5);
cx->ks[5] = ff(ss[5]);
ss[6] = word_in(in_key, 6);
cx->ks[6] = ff(ss[6]);
ss[7] = word_in(in_key, 7);
cx->ks[7] = ff(ss[7]);
kdf8(cx->ks, 0); kd8(cx->ks, 1);
kd8(cx->ks, 2); kd8(cx->ks, 3);
kd8(cx->ks, 4); kd8(cx->ks, 5);
kdl8(cx->ks, 6);
#endif
#ifdef AES_ERR_CHK
return aes_good;
#endif
}
#endif
#if defined(AES_VAR)
aes_rval aes_decrypt_key(const void *in_key, int key_len, aes_decrypt_ctx cx[1])
{
switch(key_len)
{
#ifdef AES_ERR_CHK
case 16: case 128: return aes_decrypt_key128(in_key, cx);
case 24: case 192: return aes_decrypt_key192(in_key, cx);
case 32: case 256: return aes_decrypt_key256(in_key, cx);
default: return aes_error;
#else
case 16: case 128: aes_decrypt_key128(in_key, cx); return;
case 24: case 192: aes_decrypt_key192(in_key, cx); return;
case 32: case 256: aes_decrypt_key256(in_key, cx); return;
#endif
}
}
#endif
#endif

View File

@ -1,955 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2003, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 26/08/2003
My thanks go to Dag Arne Osvik for devising the schemes used here for key
length derivation from the form of the key schedule
This file contains the compilation options for AES (Rijndael) and code
that is common across encryption, key scheduling and table generation.
OPERATION
These source code files implement the AES algorithm Rijndael designed by
Joan Daemen and Vincent Rijmen. This version is designed for the standard
block size of 16 bytes and for key sizes of 128, 192 and 256 bits (16, 24
and 32 bytes).
This version is designed for flexibility and speed using operations on
32-bit words rather than operations on bytes. It can be compiled with
either big or little endian internal byte order but is faster when the
native byte order for the processor is used.
THE CIPHER INTERFACE
The cipher interface is implemented as an array of bytes in which lower
AES bit sequence indexes map to higher numeric significance within bytes.
aes_08t (an unsigned 8-bit type)
aes_32t (an unsigned 32-bit type)
struct aes_encrypt_ctx (structure for the cipher encryption context)
struct aes_decrypt_ctx (structure for the cipher decryption context)
aes_rval the function return type
C subroutine calls:
aes_rval aes_encrypt_key128(const void *in_key, aes_encrypt_ctx cx[1]);
aes_rval aes_encrypt_key192(const void *in_key, aes_encrypt_ctx cx[1]);
aes_rval aes_encrypt_key256(const void *in_key, aes_encrypt_ctx cx[1]);
aes_rval aes_encrypt(const void *in_blk,
void *out_blk, const aes_encrypt_ctx cx[1]);
aes_rval aes_decrypt_key128(const void *in_key, aes_decrypt_ctx cx[1]);
aes_rval aes_decrypt_key192(const void *in_key, aes_decrypt_ctx cx[1]);
aes_rval aes_decrypt_key256(const void *in_key, aes_decrypt_ctx cx[1]);
aes_rval aes_decrypt(const void *in_blk,
void *out_blk, const aes_decrypt_ctx cx[1]);
IMPORTANT NOTE: If you are using this C interface with dynamic tables make sure that
you call genTabs() before AES is used so that the tables are initialised.
C++ aes class subroutines:
Class AESencrypt for encryption
Construtors:
AESencrypt(void)
AESencrypt(const void *in_key) - 128 bit key
Members:
void key128(const void *in_key)
void key192(const void *in_key)
void key256(const void *in_key)
void encrypt(const void *in_blk, void *out_blk) const
Class AESdecrypt for encryption
Construtors:
AESdecrypt(void)
AESdecrypt(const void *in_key) - 128 bit key
Members:
void key128(const void *in_key)
void key192(const void *in_key)
void key256(const void *in_key)
void decrypt(const void *in_blk, void *out_blk) const
COMPILATION
The files used to provide AES (Rijndael) are
a. aes.h for the definitions needed for use in C.
b. aescpp.h for the definitions needed for use in C++.
c. aesopt.h for setting compilation options (also includes common code).
d. aescrypt.c for encryption and decrytpion, or
e. aeskey.c for key scheduling.
f. aestab.c for table loading or generation.
g. aescrypt.asm for encryption and decryption using assembler code.
h. aescrypt.mmx.asm for encryption and decryption using MMX assembler.
To compile AES (Rijndael) for use in C code use aes.h and set the
defines here for the facilities you need (key lengths, encryption
and/or decryption). Do not define AES_DLL or AES_CPP. Set the options
for optimisations and table sizes here.
To compile AES (Rijndael) for use in in C++ code use aescpp.h but do
not define AES_DLL
To compile AES (Rijndael) in C as a Dynamic Link Library DLL) use
aes.h and include the AES_DLL define.
CONFIGURATION OPTIONS (here and in aes.h)
a. set AES_DLL in aes.h if AES (Rijndael) is to be compiled as a DLL
b. You may need to set PLATFORM_BYTE_ORDER to define the byte order.
c. If you want the code to run in a specific internal byte order, then
ALGORITHM_BYTE_ORDER must be set accordingly.
d. set other configuration options decribed below.
*/
#ifndef _AESOPT_H
#define _AESOPT_H
#include "aes.h"
/* CONFIGURATION - USE OF DEFINES
Later in this section there are a number of defines that control the
operation of the code. In each section, the purpose of each define is
explained so that the relevant form can be included or excluded by
setting either 1's or 0's respectively on the branches of the related
#if clauses.
*/
/* BYTE ORDER IN 32-BIT WORDS
To obtain the highest speed on processors with 32-bit words, this code
needs to determine the byte order of the target machine. The following
block of code is an attempt to capture the most obvious ways in which
various environemnts define byte order. It may well fail, in which case
the definitions will need to be set by editing at the points marked
**** EDIT HERE IF NECESSARY **** below. My thanks to Peter Gutmann for
some of these defines (from cryptlib).
*/
#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
#ifdef __BIG_ENDIAN__
#define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
#else
#define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
#endif
/* SOME LOCAL DEFINITIONS */
#define NO_TABLES 0
#define ONE_TABLE 1
#define FOUR_TABLES 4
#define NONE 0
#define PARTIAL 1
#define FULL 2
#define aes_sw32 Byteswap::byteswap
/* 1. FUNCTIONS REQUIRED
This implementation provides subroutines for encryption, decryption
and for setting the three key lengths (separately) for encryption
and decryption. When the assembler code is not being used the following
definition blocks allow the selection of the routines that are to be
included in the compilation.
*/
#ifdef AES_ENCRYPT
#define ENCRYPTION
#define ENCRYPTION_KEY_SCHEDULE
#endif
#ifdef AES_DECRYPT
#define DECRYPTION
#define DECRYPTION_KEY_SCHEDULE
#endif
/* 2. ASSEMBLER SUPPORT
This define (which can be on the command line) enables the use of the
assembler code routines for encryption and decryption with the C code
only providing key scheduling
*/
#if 0
#define AES_ASM
#endif
/* 3. BYTE ORDER WITHIN 32 BIT WORDS
The fundamental data processing units in Rijndael are 8-bit bytes. The
input, output and key input are all enumerated arrays of bytes in which
bytes are numbered starting at zero and increasing to one less than the
number of bytes in the array in question. This enumeration is only used
for naming bytes and does not imply any adjacency or order relationship
from one byte to another. When these inputs and outputs are considered
as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to
byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte.
In this implementation bits are numbered from 0 to 7 starting at the
numerically least significant end of each byte (bit n represents 2^n).
However, Rijndael can be implemented more efficiently using 32-bit
words by packing bytes into words so that bytes 4*n to 4*n+3 are placed
into word[n]. While in principle these bytes can be assembled into words
in any positions, this implementation only supports the two formats in
which bytes in adjacent positions within words also have adjacent byte
numbers. This order is called big-endian if the lowest numbered bytes
in words have the highest numeric significance and little-endian if the
opposite applies.
This code can work in either order irrespective of the order used by the
machine on which it runs. Normally the internal byte order will be set
to the order of the processor on which the code is to be run but this
define can be used to reverse this in special situations
NOTE: Assembler code versions rely on PLATFORM_BYTE_ORDER being set
*/
#if 1 || defined(AES_ASM)
#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER
#elif 0
#define ALGORITHM_BYTE_ORDER BRG_LITTLE_ENDIAN
#elif 0
#define ALGORITHM_BYTE_ORDER BRG_BIG_ENDIAN
#else
#error The algorithm byte order is not defined
#endif
/* 4. FAST INPUT/OUTPUT OPERATIONS.
On some machines it is possible to improve speed by transferring the
bytes in the input and output arrays to and from the internal 32-bit
variables by addressing these arrays as if they are arrays of 32-bit
words. On some machines this will always be possible but there may
be a large performance penalty if the byte arrays are not aligned on
the normal word boundaries. On other machines this technique will
lead to memory access errors when such 32-bit word accesses are not
properly aligned. The option SAFE_IO avoids such problems but will
often be slower on those machines that support misaligned access
(especially so if care is taken to align the input and output byte
arrays on 32-bit word boundaries). If SAFE_IO is not defined it is
assumed that access to byte arrays as if they are arrays of 32-bit
words will not cause problems when such accesses are misaligned.
*/
#if 1 && !defined(_MSC_VER)
#define SAFE_IO
#endif
/* 5. LOOP UNROLLING
The code for encryption and decrytpion cycles through a number of rounds
that can be implemented either in a loop or by expanding the code into a
long sequence of instructions, the latter producing a larger program but
one that will often be much faster. The latter is called loop unrolling.
There are also potential speed advantages in expanding two iterations in
a loop with half the number of iterations, which is called partial loop
unrolling. The following options allow partial or full loop unrolling
to be set independently for encryption and decryption
*/
#if 1
#define ENC_UNROLL FULL
#elif 0
#define ENC_UNROLL PARTIAL
#else
#define ENC_UNROLL NONE
#endif
#if 1
#define DEC_UNROLL FULL
#elif 0
#define DEC_UNROLL PARTIAL
#else
#define DEC_UNROLL NONE
#endif
/* 6. FAST FINITE FIELD OPERATIONS
If this section is included, tables are used to provide faster finite
field arithmetic (this has no effect if FIXED_TABLES is defined).
*/
#if 0
#define FF_TABLES
#endif
/* 7. INTERNAL STATE VARIABLE FORMAT
The internal state of Rijndael is stored in a number of local 32-bit
word varaibles which can be defined either as an array or as individual
names variables. Include this section if you want to store these local
varaibles in arrays. Otherwise individual local variables will be used.
*/
#if 1
#define ARRAYS
#endif
/* In this implementation the columns of the state array are each held in
32-bit words. The state array can be held in various ways: in an array
of words, in a number of individual word variables or in a number of
processor registers. The following define maps a variable name x and
a column number c to the way the state array variable is to be held.
The first define below maps the state into an array x[c] whereas the
second form maps the state into a number of individual variables x0,
x1, etc. Another form could map individual state colums to machine
register names.
*/
#if defined(ARRAYS)
#define s(x,c) x[c]
#else
#define s(x,c) x##c
#endif
/* 8. FIXED OR DYNAMIC TABLES
When this section is included the tables used by the code are compiled
statically into the binary file. Otherwise the subroutine gen_tabs()
must be called to compute them before the code is first used.
*/
#if 1
#define FIXED_TABLES
#define DO_TABLES
#endif
/* 9. TABLE ALIGNMENT
On some systems speed will be improved by aligning the AES large lookup
tables on particular boundaries. This define should be set to a power of
two giving the desired alignment. It can be left undefined if alignment
is not needed. This option is specific to the Microsft VC++ compiler -
it seems to sometimes cause trouble for the VC++ version 6 compiler.
*/
#if 0 && defined(_MSC_VER) && (_MSC_VER >= 1300)
#define TABLE_ALIGN 64
#endif
/* 10. INTERNAL TABLE CONFIGURATION
This cipher proceeds by repeating in a number of cycles known as 'rounds'
which are implemented by a round function which can optionally be speeded
up using tables. The basic tables are each 256 32-bit words, with either
one or four tables being required for each round function depending on
how much speed is required. The encryption and decryption round functions
are different and the last encryption and decrytpion round functions are
different again making four different round functions in all.
This means that:
1. Normal encryption and decryption rounds can each use either 0, 1
or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
2. The last encryption and decryption rounds can also use either 0, 1
or 4 tables and table spaces of 0, 1024 or 4096 bytes each.
Include or exclude the appropriate definitions below to set the number
of tables used by this implementation.
*/
#if 1 /* set tables for the normal encryption round */
#define ENC_ROUND FOUR_TABLES
#elif 0
#define ENC_ROUND ONE_TABLE
#else
#define ENC_ROUND NO_TABLES
#endif
#if 1 /* set tables for the last encryption round */
#define LAST_ENC_ROUND FOUR_TABLES
#elif 0
#define LAST_ENC_ROUND ONE_TABLE
#else
#define LAST_ENC_ROUND NO_TABLES
#endif
#if 1 /* set tables for the normal decryption round */
#define DEC_ROUND FOUR_TABLES
#elif 0
#define DEC_ROUND ONE_TABLE
#else
#define DEC_ROUND NO_TABLES
#endif
#if 1 /* set tables for the last decryption round */
#define LAST_DEC_ROUND FOUR_TABLES
#elif 0
#define LAST_DEC_ROUND ONE_TABLE
#else
#define LAST_DEC_ROUND NO_TABLES
#endif
/* The decryption key schedule can be speeded up with tables in the same
way that the round functions can. Include or exclude the following
defines to set this requirement.
*/
#if 1
#define KEY_SCHED FOUR_TABLES
#elif 0
#define KEY_SCHED ONE_TABLE
#else
#define KEY_SCHED NO_TABLES
#endif
/* END OF CONFIGURATION OPTIONS */
#define RC_LENGTH (5 * (AES_BLOCK_SIZE / 4 - 2))
/* Disable or report errors on some combinations of options */
#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES
#undef LAST_ENC_ROUND
#define LAST_ENC_ROUND NO_TABLES
#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES
#undef LAST_ENC_ROUND
#define LAST_ENC_ROUND ONE_TABLE
#endif
#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE
#undef ENC_UNROLL
#define ENC_UNROLL NONE
#endif
#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES
#undef LAST_DEC_ROUND
#define LAST_DEC_ROUND NO_TABLES
#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES
#undef LAST_DEC_ROUND
#define LAST_DEC_ROUND ONE_TABLE
#endif
#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE
#undef DEC_UNROLL
#define DEC_UNROLL NONE
#endif
/* upr(x,n): rotates bytes within words by n positions, moving bytes to
higher index positions with wrap around into low positions
ups(x,n): moves bytes by n positions to higher index positions in
words but without wrap around
bval(x,n): extracts a byte from a word
NOTE: The definitions given here are intended only for use with
unsigned variables and with shift counts that are compile
time constants
*/
#if (ALGORITHM_BYTE_ORDER == BRG_LITTLE_ENDIAN)
#define upr(x,n) (((aes_32t)(x) << (8 * (n))) | ((aes_32t)(x) >> (32 - 8 * (n))))
#define ups(x,n) ((aes_32t) (x) << (8 * (n)))
#define bval(x,n) ((aes_08t)((x) >> (8 * (n))))
#define bytes2word(b0, b1, b2, b3) \
(((aes_32t)(b3) << 24) | ((aes_32t)(b2) << 16) | ((aes_32t)(b1) << 8) | (b0))
#endif
#if (ALGORITHM_BYTE_ORDER == BRG_BIG_ENDIAN)
#define upr(x,n) (((aes_32t)(x) >> (8 * (n))) | ((aes_32t)(x) << (32 - 8 * (n))))
#define ups(x,n) ((aes_32t) (x) >> (8 * (n))))
#define bval(x,n) ((aes_08t)((x) >> (24 - 8 * (n))))
#define bytes2word(b0, b1, b2, b3) \
(((aes_32t)(b0) << 24) | ((aes_32t)(b1) << 16) | ((aes_32t)(b2) << 8) | (b3))
#endif
#if defined(SAFE_IO)
#define word_in(x,c) bytes2word(((aes_08t*)(x)+4*c)[0], ((aes_08t*)(x)+4*c)[1], \
((aes_08t*)(x)+4*c)[2], ((aes_08t*)(x)+4*c)[3])
#define word_out(x,c,v) { ((aes_08t*)(x)+4*c)[0] = bval(v,0); ((aes_08t*)(x)+4*c)[1] = bval(v,1); \
((aes_08t*)(x)+4*c)[2] = bval(v,2); ((aes_08t*)(x)+4*c)[3] = bval(v,3); }
#elif (ALGORITHM_BYTE_ORDER == PLATFORM_BYTE_ORDER)
#define word_in(x,c) (*((aes_32t*)(x)+(c)))
#define word_out(x,c,v) (*((aes_32t*)(x)+(c)) = (v))
#else
#define word_in(x,c) aes_sw32(*((aes_32t*)(x)+(c)))
#define word_out(x,c,v) (*((aes_32t*)(x)+(c)) = aes_sw32(v))
#endif
/* the finite field modular polynomial and elements */
#define WPOLY 0x011b
#define BPOLY 0x1b
/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */
#define m1 0x80808080
#define m2 0x7f7f7f7f
#define gf_mulx(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY))
/* The following defines provide alternative definitions of gf_mulx that might
give improved performance if a fast 32-bit multiply is not available. Note
that a temporary variable u needs to be defined where gf_mulx is used.
#define gf_mulx(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6))
#define m4 (0x01010101 * BPOLY)
#define gf_mulx(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4)
*/
/* Work out which tables are needed for the different options */
#ifdef AES_ASM
#ifdef ENC_ROUND
#undef ENC_ROUND
#endif
#define ENC_ROUND FOUR_TABLES
#ifdef LAST_ENC_ROUND
#undef LAST_ENC_ROUND
#endif
#define LAST_ENC_ROUND FOUR_TABLES
#ifdef DEC_ROUND
#undef DEC_ROUND
#endif
#define DEC_ROUND FOUR_TABLES
#ifdef LAST_DEC_ROUND
#undef LAST_DEC_ROUND
#endif
#define LAST_DEC_ROUND FOUR_TABLES
#ifdef KEY_SCHED
#undef KEY_SCHED
#define KEY_SCHED FOUR_TABLES
#endif
#endif
#if defined(ENCRYPTION) || defined(AES_ASM)
#if ENC_ROUND == ONE_TABLE
#define FT1_SET
#elif ENC_ROUND == FOUR_TABLES
#define FT4_SET
#else
#define SBX_SET
#endif
#if LAST_ENC_ROUND == ONE_TABLE
#define FL1_SET
#elif LAST_ENC_ROUND == FOUR_TABLES
#define FL4_SET
#elif !defined(SBX_SET)
#define SBX_SET
#endif
#endif
#if defined(DECRYPTION) || defined(AES_ASM)
#if DEC_ROUND == ONE_TABLE
#define IT1_SET
#elif DEC_ROUND == FOUR_TABLES
#define IT4_SET
#else
#define ISB_SET
#endif
#if LAST_DEC_ROUND == ONE_TABLE
#define IL1_SET
#elif LAST_DEC_ROUND == FOUR_TABLES
#define IL4_SET
#elif !defined(ISB_SET)
#define ISB_SET
#endif
#endif
#if defined(ENCRYPTION_KEY_SCHEDULE) || defined(DECRYPTION_KEY_SCHEDULE)
#if KEY_SCHED == ONE_TABLE
#define LS1_SET
#define IM1_SET
#elif KEY_SCHED == FOUR_TABLES
#define LS4_SET
#define IM4_SET
#elif !defined(SBX_SET)
#define SBX_SET
#endif
#endif
/* generic definitions of Rijndael macros that use tables */
#define no_table(x,box,vf,rf,c) bytes2word( \
box[bval(vf(x,0,c),rf(0,c))], \
box[bval(vf(x,1,c),rf(1,c))], \
box[bval(vf(x,2,c),rf(2,c))], \
box[bval(vf(x,3,c),rf(3,c))])
#define one_table(x,op,tab,vf,rf,c) \
( tab[bval(vf(x,0,c),rf(0,c))] \
^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \
^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \
^ op(tab[bval(vf(x,3,c),rf(3,c))],3))
#define four_tables(x,tab,vf,rf,c) \
( tab[0][bval(vf(x,0,c),rf(0,c))] \
^ tab[1][bval(vf(x,1,c),rf(1,c))] \
^ tab[2][bval(vf(x,2,c),rf(2,c))] \
^ tab[3][bval(vf(x,3,c),rf(3,c))])
#define vf1(x,r,c) (x)
#define rf1(r,c) (r)
#define rf2(r,c) ((8+r-c)&3)
/* perform forward and inverse column mix operation on four bytes in long word x in */
/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */
#if defined(FM4_SET) /* not currently used */
#define fwd_mcol(x) four_tables(x,t_use(f,m),vf1,rf1,0)
#elif defined(FM1_SET) /* not currently used */
#define fwd_mcol(x) one_table(x,upr,t_use(f,m),vf1,rf1,0)
#else
#define dec_fmvars aes_32t g2
#define fwd_mcol(x) (g2 = gf_mulx(x), g2 ^ upr((x) ^ g2, 3) ^ upr((x), 2) ^ upr((x), 1))
#endif
#if defined(IM4_SET)
#define inv_mcol(x) four_tables(x,t_use(i,m),vf1,rf1,0)
#elif defined(IM1_SET)
#define inv_mcol(x) one_table(x,upr,t_use(i,m),vf1,rf1,0)
#else
#define dec_imvars aes_32t g2, g4, g9
#define inv_mcol(x) (g2 = gf_mulx(x), g4 = gf_mulx(g2), g9 = (x) ^ gf_mulx(g4), g4 ^= g9, \
(x) ^ g2 ^ g4 ^ upr(g2 ^ g9, 3) ^ upr(g4, 2) ^ upr(g9, 1))
#endif
#if defined(FL4_SET)
#define ls_box(x,c) four_tables(x,t_use(f,l),vf1,rf2,c)
#elif defined(LS4_SET)
#define ls_box(x,c) four_tables(x,t_use(l,s),vf1,rf2,c)
#elif defined(FL1_SET)
#define ls_box(x,c) one_table(x,upr,t_use(f,l),vf1,rf2,c)
#elif defined(LS1_SET)
#define ls_box(x,c) one_table(x,upr,t_use(l,s),vf1,rf2,c)
#else
#define ls_box(x,c) no_table(x,t_use(s,box),vf1,rf2,c)
#endif
/* If there are no global variables, the definitions here can be
used to put the AES tables in a structure so that a pointer
can then be added to the AES context to pass them to the AES
routines that need them. If this facility is used, the calling
program has to ensure that this pointer is managed appropriately.
In particular, the value of the t_dec(in,it) item in the table
structure must be set to zero in order to ensure that the tables
are initialised. In practice the three code sequences in aeskey.c
that control the calls to gen_tabs() and the gen_tabs() routine
itself will have to be changed for a specific implementation. If
global variables are available it will generally be preferable to
use them with the precomputed FIXED_TABLES option that uses static
global tables.
The following defines can be used to control the way the tables
are defined, initialised and used in embedded environments that
require special features for these purposes
the 't_dec' construction is used to declare fixed table arrays
the 't_set' construction is used to set fixed table values
the 't_use' construction is used to access fixed table values
256 byte tables:
t_xxx(s,box) => forward S box
t_xxx(i,box) => inverse S box
256 32-bit word OR 4 x 256 32-bit word tables:
t_xxx(f,n) => forward normal round
t_xxx(f,l) => forward last round
t_xxx(i,n) => inverse normal round
t_xxx(i,l) => inverse last round
t_xxx(l,s) => key schedule table
t_xxx(i,m) => key schedule table
Other variables and tables:
t_xxx(r,c) => the rcon table
*/
#define t_dec(m,n) t_##m##n
#define t_set(m,n) t_##m##n
#define t_use(m,n) t_##m##n
#if defined(DO_TABLES) /* declare and instantiate tables */
/* finite field arithmetic operations for table generation */
#if defined(FIXED_TABLES) || !defined(FF_TABLES)
#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY))
#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY))
#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \
^ (((x>>5) & 4) * WPOLY))
#define f3(x) (f2(x) ^ x)
#define f9(x) (f8(x) ^ x)
#define fb(x) (f8(x) ^ f2(x) ^ x)
#define fd(x) (f8(x) ^ f4(x) ^ x)
#define fe(x) (f8(x) ^ f4(x) ^ f2(x))
#else
#define f2(x) ((x) ? pow[log[x] + 0x19] : 0)
#define f3(x) ((x) ? pow[log[x] + 0x01] : 0)
#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0)
#define fb(x) ((x) ? pow[log[x] + 0x68] : 0)
#define fd(x) ((x) ? pow[log[x] + 0xee] : 0)
#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0)
#define fi(x) ((x) ? pow[ 255 - log[x]] : 0)
#endif
#if defined(FIXED_TABLES) /* declare and set values for static tables */
#define sb_data(w) \
w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\
w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\
w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\
w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\
w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\
w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\
w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\
w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\
w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\
w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\
w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\
w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\
w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\
w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\
w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\
w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\
w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\
w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\
w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\
w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\
w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\
w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\
w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\
w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\
w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\
w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\
w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\
w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\
w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\
w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\
w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\
w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16)
#define isb_data(w) \
w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\
w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\
w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\
w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\
w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\
w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\
w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\
w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\
w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\
w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\
w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\
w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\
w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\
w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\
w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\
w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\
w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\
w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\
w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\
w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\
w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\
w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\
w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\
w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\
w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\
w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\
w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\
w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\
w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\
w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\
w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\
w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d),
#define mm_data(w) \
w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\
w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\
w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\
w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\
w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\
w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\
w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\
w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\
w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\
w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\
w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\
w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\
w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\
w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\
w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\
w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\
w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\
w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\
w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\
w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\
w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\
w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\
w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\
w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\
w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\
w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\
w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\
w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\
w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\
w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\
w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\
w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff)
#define h0(x) (x)
/* These defines are used to ensure tables are generated in the
right format depending on the internal byte order required
*/
#define w0(p) bytes2word(p, 0, 0, 0)
#define w1(p) bytes2word(0, p, 0, 0)
#define w2(p) bytes2word(0, 0, p, 0)
#define w3(p) bytes2word(0, 0, 0, p)
#define u0(p) bytes2word(f2(p), p, p, f3(p))
#define u1(p) bytes2word(f3(p), f2(p), p, p)
#define u2(p) bytes2word(p, f3(p), f2(p), p)
#define u3(p) bytes2word(p, p, f3(p), f2(p))
#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p))
#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p))
#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p))
#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p))
const aes_32t t_dec(r,c)[RC_LENGTH] =
{
w0(0x01), w0(0x02), w0(0x04), w0(0x08), w0(0x10),
w0(0x20), w0(0x40), w0(0x80), w0(0x1b), w0(0x36)
};
#if defined(__BORLANDC__)
#define concat(s1, s2) s1##s2
#define d_1(t,n,b,v) const t n[256] = { b(concat(v,0)) }
#define d_4(t,n,b,v) const t n[4][256] = { { b(concat(v,0)) }, { b(concat(v,1)) }, { b(concat(v,2)) }, { b(concat(v,3)) } }
#else
#define d_1(t,n,b,v) const t n[256] = { b(v##0) }
#define d_4(t,n,b,v) const t n[4][256] = { { b(v##0) }, { b(v##1) }, { b(v##2) }, { b(v##3) } }
#endif
#else /* declare and instantiate tables for dynamic value generation in in tab.c */
aes_32t t_dec(r,c)[RC_LENGTH];
#define d_1(t,n,b,v) t n[256]
#define d_4(t,n,b,v) t n[4][256]
#endif
#else /* declare tables without instantiation */
#if defined(FIXED_TABLES)
extern const aes_32t t_dec(r,c)[RC_LENGTH];
#if defined(_MSC_VER) && defined(TABLE_ALIGN)
#define d_1(t,n,b,v) extern __declspec(align(TABLE_ALIGN)) const t n[256]
#define d_4(t,n,b,v) extern __declspec(align(TABLE_ALIGN)) const t n[4][256]
#else
#define d_1(t,n,b,v) extern const t n[256]
#define d_4(t,n,b,v) extern const t n[4][256]
#endif
#else
extern aes_32t t_dec(r,c)[RC_LENGTH];
#if defined(_MSC_VER) && defined(TABLE_ALIGN)
#define d_1(t,n,b,v) extern __declspec(align(TABLE_ALIGN)) t n[256]
#define d_4(t,n,b,v) extern __declspec(align(TABLE_ALIGN)) t n[4][256]
#else
#define d_1(t,n,b,v) extern t n[256]
#define d_4(t,n,b,v) extern t n[4][256]
#endif
#endif
#endif
#ifdef SBX_SET
d_1(aes_08t, t_dec(s,box), sb_data, h);
#endif
#ifdef ISB_SET
d_1(aes_08t, t_dec(i,box), isb_data, h);
#endif
#ifdef FT1_SET
d_1(aes_32t, t_dec(f,n), sb_data, u);
#endif
#ifdef FT4_SET
d_4(aes_32t, t_dec(f,n), sb_data, u);
#endif
#ifdef FL1_SET
d_1(aes_32t, t_dec(f,l), sb_data, w);
#endif
#ifdef FL4_SET
d_4(aes_32t, t_dec(f,l), sb_data, w);
#endif
#ifdef IT1_SET
d_1(aes_32t, t_dec(i,n), isb_data, v);
#endif
#ifdef IT4_SET
d_4(aes_32t, t_dec(i,n), isb_data, v);
#endif
#ifdef IL1_SET
d_1(aes_32t, t_dec(i,l), isb_data, w);
#endif
#ifdef IL4_SET
d_4(aes_32t, t_dec(i,l), isb_data, w);
#endif
#ifdef LS1_SET
#ifdef FL1_SET
#undef LS1_SET
#else
d_1(aes_32t, t_dec(l,s), sb_data, w);
#endif
#endif
#ifdef LS4_SET
#ifdef FL4_SET
#undef LS4_SET
#else
d_4(aes_32t, t_dec(l,s), sb_data, w);
#endif
#endif
#ifdef IM1_SET
d_1(aes_32t, t_dec(i,m), mm_data, v);
#endif
#ifdef IM4_SET
d_4(aes_32t, t_dec(i,m), mm_data, v);
#endif
#endif

View File

@ -1,223 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2003, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 26/08/2003
*/
#define DO_TABLES
#include "aesopt.h"
#if defined(FIXED_TABLES)
/* implemented in case of wrong call for fixed tables */
void gen_tabs(void)
{
}
#else /* dynamic table generation */
#if !defined(FF_TABLES)
/* Generate the tables for the dynamic table option
It will generally be sensible to use tables to compute finite
field multiplies and inverses but where memory is scarse this
code might sometimes be better. But it only has effect during
initialisation so its pretty unimportant in overall terms.
*/
/* return 2 ^ (n - 1) where n is the bit number of the highest bit
set in x with x in the range 1 < x < 0x00000200. This form is
used so that locals within fi can be bytes rather than words
*/
static aes_08t hibit(const aes_32t x)
{ aes_08t r = (aes_08t)((x >> 1) | (x >> 2));
r |= (r >> 2);
r |= (r >> 4);
return (r + 1) >> 1;
}
/* return the inverse of the finite field element x */
static aes_08t fi(const aes_08t x)
{ aes_08t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0;
if(x < 2) return x;
for(;;)
{
if(!n1) return v1;
while(n2 >= n1)
{
n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2);
}
if(!n2) return v2;
while(n1 >= n2)
{
n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1);
}
}
}
#endif
/* The forward and inverse affine transformations used in the S-box */
#define fwd_affine(x) \
(w = (aes_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(aes_08t)(w^(w>>8)))
#define inv_affine(x) \
(w = (aes_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(aes_08t)(w^(w>>8)))
static int init = 0;
void gen_tabs(void)
{ aes_32t i, w;
#if defined(FF_TABLES)
aes_08t pow[512], log[256];
if(init) return;
/* log and power tables for GF(2^8) finite field with
WPOLY as modular polynomial - the simplest primitive
root is 0x03, used here to generate the tables
*/
i = 0; w = 1;
do
{
pow[i] = (aes_08t)w;
pow[i + 255] = (aes_08t)w;
log[w] = (aes_08t)i++;
w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0);
}
while (w != 1);
#else
if(init) return;
#endif
for(i = 0, w = 1; i < RC_LENGTH; ++i)
{
t_set(r,c)[i] = bytes2word(w, 0, 0, 0);
w = f2(w);
}
for(i = 0; i < 256; ++i)
{ aes_08t b;
b = fwd_affine(fi((aes_08t)i));
w = bytes2word(f2(b), b, b, f3(b));
#ifdef SBX_SET
t_set(s,box)[i] = b;
#endif
#ifdef FT1_SET /* tables for a normal encryption round */
t_set(f,n)[i] = w;
#endif
#ifdef FT4_SET
t_set(f,n)[0][i] = w;
t_set(f,n)[1][i] = upr(w,1);
t_set(f,n)[2][i] = upr(w,2);
t_set(f,n)[3][i] = upr(w,3);
#endif
w = bytes2word(b, 0, 0, 0);
#ifdef FL1_SET /* tables for last encryption round (may also */
t_set(f,l)[i] = w; /* be used in the key schedule) */
#endif
#ifdef FL4_SET
t_set(f,l)[0][i] = w;
t_set(f,l)[1][i] = upr(w,1);
t_set(f,l)[2][i] = upr(w,2);
t_set(f,l)[3][i] = upr(w,3);
#endif
#ifdef LS1_SET /* table for key schedule if t_set(f,l) above is */
t_set(l,s)[i] = w; /* not of the required form */
#endif
#ifdef LS4_SET
t_set(l,s)[0][i] = w;
t_set(l,s)[1][i] = upr(w,1);
t_set(l,s)[2][i] = upr(w,2);
t_set(l,s)[3][i] = upr(w,3);
#endif
b = fi(inv_affine((aes_08t)i));
w = bytes2word(fe(b), f9(b), fd(b), fb(b));
#ifdef IM1_SET /* tables for the inverse mix column operation */
t_set(i,m)[b] = w;
#endif
#ifdef IM4_SET
t_set(i,m)[0][b] = w;
t_set(i,m)[1][b] = upr(w,1);
t_set(i,m)[2][b] = upr(w,2);
t_set(i,m)[3][b] = upr(w,3);
#endif
#ifdef ISB_SET
t_set(i,box)[i] = b;
#endif
#ifdef IT1_SET /* tables for a normal decryption round */
t_set(i,n)[i] = w;
#endif
#ifdef IT4_SET
t_set(i,n)[0][i] = w;
t_set(i,n)[1][i] = upr(w,1);
t_set(i,n)[2][i] = upr(w,2);
t_set(i,n)[3][i] = upr(w,3);
#endif
w = bytes2word(b, 0, 0, 0);
#ifdef IL1_SET /* tables for last decryption round */
t_set(i,l)[i] = w;
#endif
#ifdef IL4_SET
t_set(i,l)[0][i] = w;
t_set(i,l)[1][i] = upr(w,1);
t_set(i,l)[2][i] = upr(w,2);
t_set(i,l)[3][i] = upr(w,3);
#endif
}
init = 1;
}
#endif

View File

@ -1,138 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
-------------------------------------------------------------------------
Issue Date: 26/08/2003
This file implements password based file encryption and authentication
using AES in CTR mode, HMAC-SHA1 authentication and RFC2898 password
based key derivation.
*/
#include <memory.h>
#include "fileenc.h"
/* subroutine for data encryption/decryption */
/* this could be speeded up a lot by aligning */
/* buffers and using 32 bit operations */
static void encr_data(unsigned char data[], unsigned long d_len, fcrypt_ctx cx[1])
{
unsigned long i = 0, pos = cx->encr_pos;
while(i < d_len)
{
if(pos == BLOCK_SIZE)
{ unsigned int j = 0;
/* increment encryption nonce */
while(j < 8 && !++cx->nonce[j])
++j;
/* encrypt the nonce to form next xor buffer */
aes_encrypt(cx->nonce, cx->encr_bfr, cx->encr_ctx);
pos = 0;
}
data[i++] ^= cx->encr_bfr[pos++];
}
cx->encr_pos = pos;
}
int fcrypt_init(
int mode, /* the mode to be used (input) */
const unsigned char pwd[], /* the user specified password (input) */
unsigned int pwd_len, /* the length of the password (input) */
const unsigned char salt[], /* the salt (input) */
#ifdef PASSWORD_VERIFIER
unsigned char pwd_ver[PWD_VER_LENGTH], /* 2 byte password verifier (output) */
#endif
fcrypt_ctx cx[1]) /* the file encryption context (output) */
{
unsigned char kbuf[2 * MAX_KEY_LENGTH + PWD_VER_LENGTH];
if(pwd_len > MAX_PWD_LENGTH)
return PASSWORD_TOO_LONG;
if(mode < 1 || mode > 3)
return BAD_MODE;
cx->mode = mode;
cx->pwd_len = pwd_len;
/* initialise the encryption nonce and buffer pos */
cx->encr_pos = BLOCK_SIZE;
/* if we need a random component in the encryption */
/* nonce, this is where it would have to be set */
memset(cx->nonce, 0, BLOCK_SIZE * sizeof(unsigned char));
/* initialise for authentication */
hmac_sha_begin(cx->auth_ctx);
/* derive the encryption and authetication keys and the password verifier */
derive_key(pwd, pwd_len, salt, SALT_LENGTH(mode), KEYING_ITERATIONS,
kbuf, 2 * KEY_LENGTH(mode) + PWD_VER_LENGTH);
/* set the encryption key */
aes_encrypt_key(kbuf, KEY_LENGTH(mode), cx->encr_ctx);
/* set the authentication key */
hmac_sha_key(kbuf + KEY_LENGTH(mode), KEY_LENGTH(mode), cx->auth_ctx);
#ifdef PASSWORD_VERIFIER
memcpy(pwd_ver, kbuf + 2 * KEY_LENGTH(mode), PWD_VER_LENGTH);
#endif
/* clear the buffer holding the derived key values */
memset(kbuf, 0, 2 * KEY_LENGTH(mode) + PWD_VER_LENGTH);
return GOOD_RETURN;
}
/* perform 'in place' encryption and authentication */
void fcrypt_encrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1])
{
encr_data(data, data_len, cx);
hmac_sha_data(data, data_len, cx->auth_ctx);
}
/* perform 'in place' authentication and decryption */
void fcrypt_decrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1])
{
hmac_sha_data(data, data_len, cx->auth_ctx);
encr_data(data, data_len, cx);
}
/* close encryption/decryption and return the MAC value */
int fcrypt_end(unsigned char mac[], fcrypt_ctx cx[1])
{
hmac_sha_end(mac, MAC_LENGTH(cx->mode), cx->auth_ctx);
memset(cx, 0, sizeof(fcrypt_ctx)); /* clear the encryption context */
return MAC_LENGTH(cx->mode); /* return MAC length in bytes */
}

View File

@ -1,114 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 24/01/2003
This file contains the header file for fileenc.c, which implements password
based file encryption and authentication using AES in CTR mode, HMAC-SHA1
authentication and RFC2898 password based key derivation.
*/
#ifndef _FENC_H
#define _FENC_H
#include "aes.h"
#include "hmac.h"
#include "pwd2key.h"
#define BLOCK_SIZE AES_BLOCK_SIZE
#define PASSWORD_VERIFIER
#define MAX_KEY_LENGTH 32
#define MAX_PWD_LENGTH 128
#define MAX_SALT_LENGTH 16
#define KEYING_ITERATIONS 1000
#ifdef PASSWORD_VERIFIER
#define PWD_VER_LENGTH 2
#else
#define PWD_VER_LENGTH 0
#endif
#define GOOD_RETURN 0
#define PASSWORD_TOO_LONG -100
#define BAD_MODE -101
/*
Field lengths (in bytes) versus File Encryption Mode (0 < mode < 4)
Mode Key Salt MAC Overhead
1 16 8 10 18
2 24 12 10 22
3 32 16 10 26
The following macros assume that the mode value is correct.
*/
#define KEY_LENGTH(mode) (8 * (mode & 3) + 8)
#define SALT_LENGTH(mode) (4 * (mode & 3) + 4)
#define MAC_LENGTH(mode) (10)
/* the context for file encryption */
typedef struct
{ unsigned char nonce[BLOCK_SIZE]; /* the CTR nonce */
unsigned char encr_bfr[BLOCK_SIZE]; /* encrypt buffer */
aes_encrypt_ctx encr_ctx[1]; /* encryption context */
hmac_ctx auth_ctx[1]; /* authentication context */
unsigned int encr_pos; /* block position (enc) */
unsigned int pwd_len; /* password length */
unsigned int mode; /* File encryption mode */
} fcrypt_ctx;
/* initialise file encryption or decryption */
int fcrypt_init(
int mode, /* the mode to be used (input) */
const unsigned char pwd[], /* the user specified password (input) */
unsigned int pwd_len, /* the length of the password (input) */
const unsigned char salt[], /* the salt (input) */
#ifdef PASSWORD_VERIFIER
unsigned char pwd_ver[PWD_VER_LENGTH], /* 2 byte password verifier (output) */
#endif
fcrypt_ctx cx[1]); /* the file encryption context (output) */
/* perform 'in place' encryption or decryption and authentication */
void fcrypt_encrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]);
void fcrypt_decrypt(unsigned char data[], unsigned int data_len, fcrypt_ctx cx[1]);
/* close encryption/decryption and return the MAC value */
/* the return value is the length of the MAC */
int fcrypt_end(unsigned char mac[], /* the MAC value (output) */
fcrypt_ctx cx[1]); /* the context (input) */
#endif

View File

@ -1,142 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 26/08/2003
Includes a bugfix from Dr Brian Gladman made on 16/04/2012 for compiling on 64-bit
This is an implementation of HMAC, the FIPS standard keyed hash function
*/
#include <string.h>
#include "hmac.h"
#define HMAC_IPAD (0x36 * (((unsigned long)-1) / 0xff))
#define HMAC_OPAD (0x5c * (((unsigned long)-1) / 0xff))
/* initialise the HMAC context to zero */
void hmac_sha_begin(hmac_ctx cx[1])
{
memset(cx, 0, sizeof(hmac_ctx));
}
/* input the HMAC key (can be called multiple times) */
int hmac_sha_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1])
{
if(cx->klen == HMAC_IN_DATA) /* error if further key input */
return HMAC_BAD_MODE; /* is attempted in data mode */
if(cx->klen + key_len > HMAC_HASH_INPUT_SIZE) /* if the key has to be hashed */
{
if(cx->klen <= HMAC_HASH_INPUT_SIZE) /* if the hash has not yet been */
{ /* started, initialise it and */
sha_begin(cx->ctx); /* hash stored key characters */
sha_hash(cx->key, cx->klen, cx->ctx);
}
sha_hash(key, key_len, cx->ctx); /* hash long key data into hash */
}
else /* otherwise store key data */
memcpy(cx->key + cx->klen, key, key_len);
cx->klen += key_len; /* update the key length count */
return HMAC_OK;
}
/* input the HMAC data (can be called multiple times) - */
/* note that this call terminates the key input phase */
void hmac_sha_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1])
{ unsigned int i;
if(cx->klen != HMAC_IN_DATA) /* if not yet in data phase */
{
if(cx->klen > HMAC_HASH_INPUT_SIZE) /* if key is being hashed */
{ /* complete the hash and */
sha_end(cx->key, cx->ctx); /* store the result as the */
cx->klen = HMAC_HASH_OUTPUT_SIZE; /* key and set new length */
}
/* pad the key if necessary */
memset(cx->key + cx->klen, 0, HMAC_HASH_INPUT_SIZE - cx->klen);
/* xor ipad into key value */
for(i = 0; i < HMAC_HASH_INPUT_SIZE / sizeof(unsigned long); ++i)
((unsigned long*)cx->key)[i] ^= HMAC_IPAD;
/* and start hash operation */
sha_begin(cx->ctx);
sha_hash(cx->key, HMAC_HASH_INPUT_SIZE, cx->ctx);
/* mark as now in data mode */
cx->klen = HMAC_IN_DATA;
}
/* hash the data (if any) */
if(data_len)
sha_hash(data, data_len, cx->ctx);
}
/* compute and output the MAC value */
void hmac_sha_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1])
{ unsigned char dig[HMAC_HASH_OUTPUT_SIZE];
unsigned int i;
/* if no data has been entered perform a null data phase */
if(cx->klen != HMAC_IN_DATA)
hmac_sha_data((const unsigned char*)0, 0, cx);
sha_end(dig, cx->ctx); /* complete the inner hash */
/* set outer key value using opad and removing ipad */
for(i = 0; i < HMAC_HASH_INPUT_SIZE / sizeof(unsigned long); ++i)
((unsigned long*)cx->key)[i] ^= HMAC_OPAD ^ HMAC_IPAD;
/* perform the outer hash operation */
sha_begin(cx->ctx);
sha_hash(cx->key, HMAC_HASH_INPUT_SIZE, cx->ctx);
sha_hash(dig, HMAC_HASH_OUTPUT_SIZE, cx->ctx);
sha_end(dig, cx->ctx);
/* output the hash value */
for(i = 0; i < mac_len; ++i)
mac[i] = dig[i];
}
/* 'do it all in one go' subroutine */
void hmac_sha(const unsigned char key[], unsigned long key_len,
const unsigned char data[], unsigned long data_len,
unsigned char mac[], unsigned long mac_len)
{ hmac_ctx cx[1];
hmac_sha_begin(cx);
hmac_sha_key(key, key_len, cx);
hmac_sha_data(data, data_len, cx);
hmac_sha_end(mac, mac_len, cx);
}

View File

@ -1,95 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 26/08/2003
Includes a bugfix from Dr Brian Gladman made on 16/04/2012 for compiling on 64-bit
This is an implementation of HMAC, the FIPS standard keyed hash function
*/
#ifndef _HMAC_H
#define _HMAC_H
#include <memory.h>
#define USE_SHA1 // Irrlicht only cares about SHA1 for now
#if !defined(USE_SHA1) && !defined(USE_SHA256)
#error define USE_SHA1 or USE_SHA256 to set the HMAC hash algorithm
#endif
#ifdef USE_SHA1
#include "sha1.h"
#define HMAC_HASH_INPUT_SIZE SHA1_BLOCK_SIZE
#define HMAC_HASH_OUTPUT_SIZE SHA1_DIGEST_SIZE
#define sha_ctx sha1_ctx
#define sha_begin sha1_begin
#define sha_hash sha1_hash
#define sha_end sha1_end
#endif
#ifdef USE_SHA256
#include "sha2.h"
#define HMAC_HASH_INPUT_SIZE SHA256_BLOCK_SIZE
#define HMAC_HASH_OUTPUT_SIZE SHA256_DIGEST_SIZE
#define sha_ctx sha256_ctx
#define sha_begin sha256_begin
#define sha_hash sha256_hash
#define sha_end sha256_end
#endif
#define HMAC_OK 0
#define HMAC_BAD_MODE -1
#define HMAC_IN_DATA 0xffffffff
typedef struct
{ unsigned char key[HMAC_HASH_INPUT_SIZE];
sha_ctx ctx[1];
unsigned long klen;
} hmac_ctx;
void hmac_sha_begin(hmac_ctx cx[1]);
int hmac_sha_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1]);
void hmac_sha_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1]);
void hmac_sha_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1]);
void hmac_sha(const unsigned char key[], unsigned long key_len,
const unsigned char data[], unsigned long data_len,
unsigned char mac[], unsigned long mac_len);
#endif

View File

@ -1,147 +0,0 @@
/*
---------------------------------------------------------------------------
Copyright (c) 2002, Dr Brian Gladman < >, Worcester, UK.
All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 24/01/2003
This file implements a random data pool based on the use of an external
entropy function. It is based on the ideas advocated by Peter Gutmann in
his work on pseudo random sequence generators. It is not a 'paranoid'
random sequence generator and no attempt is made to protect the pool
from prying eyes either by memory locking or by techniques to obscure
its location in memory.
*/
#include <memory.h>
#include <string.h>
#include "prng.h"
/* mix a random data pool using the SHA1 compression function (as */
/* suggested by Peter Gutmann in his paper on random pools) */
static void prng_mix(unsigned char buf[])
{ unsigned int i, len;
sha1_ctx ctx[1];
/*lint -e{663} unusual array to pointer conversion */
for(i = 0; i < PRNG_POOL_SIZE; i += SHA1_DIGEST_SIZE)
{
/* copy digest size pool block into SHA1 hash block */
memcpy(ctx->hash, buf + (i ? i : PRNG_POOL_SIZE)
- SHA1_DIGEST_SIZE, SHA1_DIGEST_SIZE);
/* copy data from pool into the SHA1 data buffer */
len = PRNG_POOL_SIZE - i;
memcpy(ctx->wbuf, buf + i, (len > SHA1_BLOCK_SIZE ? SHA1_BLOCK_SIZE : len));
if(len < SHA1_BLOCK_SIZE)
memcpy(((char*)ctx->wbuf) + len, buf, SHA1_BLOCK_SIZE - len);
/* compress using the SHA1 compression function */
sha1_compile(ctx);
/* put digest size block back into the random pool */
memcpy(buf + i, ctx->hash, SHA1_DIGEST_SIZE);
}
}
/* refresh the output buffer and update the random pool by adding */
/* entropy and remixing */
static void update_pool(prng_ctx ctx[1])
{ unsigned int i = 0;
/* transfer random pool data to the output buffer */
memcpy(ctx->obuf, ctx->rbuf, PRNG_POOL_SIZE);
/* enter entropy data into the pool */
while(i < PRNG_POOL_SIZE)
i += ctx->entropy(ctx->rbuf + i, PRNG_POOL_SIZE - i);
/* invert and xor the original pool data into the pool */
for(i = 0; i < PRNG_POOL_SIZE; ++i)
ctx->rbuf[i] ^= ~ctx->obuf[i];
/* mix the pool and the output buffer */
prng_mix(ctx->rbuf);
prng_mix(ctx->obuf);
}
void prng_init(prng_entropy_fn fun, prng_ctx ctx[1])
{ int i;
/* clear the buffers and the counter in the context */
memset(ctx, 0, sizeof(prng_ctx));
/* set the pointer to the entropy collection function */
ctx->entropy = fun;
/* initialise the random data pool */
update_pool(ctx);
/* mix the pool a minimum number of times */
for(i = 0; i < PRNG_MIN_MIX; ++i)
prng_mix(ctx->rbuf);
/* update the pool to prime the pool output buffer */
update_pool(ctx);
}
/* provide random bytes from the random data pool */
void prng_rand(unsigned char data[], unsigned int data_len, prng_ctx ctx[1])
{ unsigned char *rp = data;
unsigned int len, pos = ctx->pos;
while(data_len)
{
/* transfer 'data_len' bytes (or the number of bytes remaining */
/* the pool output buffer if less) into the output */
len = (data_len < PRNG_POOL_SIZE - pos ? data_len : PRNG_POOL_SIZE - pos);
memcpy(rp, ctx->obuf + pos, len);
rp += len; /* update ouput buffer position pointer */
pos += len; /* update pool output buffer pointer */
data_len -= len; /* update the remaining data count */
/* refresh the random pool if necessary */
if(pos == PRNG_POOL_SIZE)
{
update_pool(ctx); pos = 0;
}
}
ctx->pos = pos;
}
void prng_end(prng_ctx ctx[1])
{
/* ensure the data in the context is destroyed */
memset(ctx, 0, sizeof(prng_ctx));
}

Some files were not shown because too many files have changed in this diff Show More