mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
AGS: Added std class implementations and allegro stubs
This commit is contained in:
parent
0faeeb8087
commit
df58db6659
@ -2,7 +2,21 @@ MODULE := engines/ags
|
||||
|
||||
MODULE_OBJS = \
|
||||
ags.o \
|
||||
metaengine.o
|
||||
metaengine.o \
|
||||
stubs/allegro.o \
|
||||
stubs/allegro/color.o \
|
||||
stubs/allegro/config.o \
|
||||
stubs/allegro/digi.o \
|
||||
stubs/allegro/error.o \
|
||||
stubs/allegro/file.o \
|
||||
stubs/allegro/fixed.o \
|
||||
stubs/allegro/gfx.o \
|
||||
stubs/allegro/keyboard.o \
|
||||
stubs/allegro/midi.o \
|
||||
stubs/allegro/mouse.o \
|
||||
stubs/allegro/sound.o \
|
||||
stubs/allegro/system.o \
|
||||
stubs/allegro/unicode.o
|
||||
|
||||
|
||||
# This module can be built as a plugin
|
||||
|
44
engines/ags/std/array.h
Normal file
44
engines/ags/std/array.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_ARRAY_H
|
||||
#define AGS_STD_ARRAY_H
|
||||
|
||||
#include "common/array.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
template<class T>
|
||||
class array : public Common::Array<T> {
|
||||
public:
|
||||
array() : Common::Array<T>() {
|
||||
}
|
||||
array(size_t size) : Common::Array<T>() {
|
||||
Common::Array<T>::resize(size);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
85
engines/ags/std/chrono.h
Normal file
85
engines/ags/std/chrono.h
Normal file
@ -0,0 +1,85 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_CHRONO_H
|
||||
#define AGS_STD_CHRONO_H
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
namespace chrono {
|
||||
|
||||
typedef uint32 milliseconds;
|
||||
|
||||
struct system_clock {
|
||||
};
|
||||
|
||||
|
||||
struct steady_clock { // wraps QueryPerformanceCounter
|
||||
using rep = uint32;
|
||||
using period = milliseconds;
|
||||
using duration = milliseconds;
|
||||
using time_point = uint32;
|
||||
static constexpr bool is_steady = true;
|
||||
|
||||
static time_point now() { // get current time
|
||||
return g_system->getMillis();
|
||||
}
|
||||
};
|
||||
|
||||
using high_resolution_clock = steady_clock;
|
||||
|
||||
class duration {
|
||||
private:
|
||||
uint32 _value;
|
||||
public:
|
||||
duration() : _value(0) {
|
||||
}
|
||||
duration(uint32 value) : _value(value) {
|
||||
}
|
||||
|
||||
size_t count() const {
|
||||
// durations for ScummVM are hardcoded to be in milliseconds
|
||||
return 1000;
|
||||
}
|
||||
|
||||
operator milliseconds() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
duration duration_cast(T param);
|
||||
|
||||
template<milliseconds>
|
||||
duration duration_cast(milliseconds param) {
|
||||
return duration(param);
|
||||
}
|
||||
|
||||
} // namespace chrono
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
45
engines/ags/std/functional.h
Normal file
45
engines/ags/std/functional.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_FUNCTIONAL_H
|
||||
#define AGS_STD_FUNCTIONAL_H
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct unary_function { // base class for unary functions
|
||||
using argument_type = _Arg;
|
||||
using result_type = _Result;
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct binary_function { // base class for binary functions
|
||||
using first_argument_type = _Arg1;
|
||||
using second_argument_type = _Arg2;
|
||||
using result_type = _Result;
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
49
engines/ags/std/limits.h
Normal file
49
engines/ags/std/limits.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#ifndef AGS_STD_LIMITS_H
|
||||
#define AGS_STD_LIMITS_H
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
class _Num_base {
|
||||
};
|
||||
|
||||
template <class _Ty>
|
||||
class numeric_limits : public _Num_base {
|
||||
};
|
||||
|
||||
template <>
|
||||
class numeric_limits<float> {
|
||||
public:
|
||||
static constexpr float quiet_NaN() {
|
||||
return NAN;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
77
engines/ags/std/list.h
Normal file
77
engines/ags/std/list.h
Normal file
@ -0,0 +1,77 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_LIST_H
|
||||
#define AGS_STD_LIST_H
|
||||
|
||||
#include "common/list.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
template<class T>
|
||||
class list : public Common::List<T> {
|
||||
public:
|
||||
struct reverse_iterator {
|
||||
private:
|
||||
typename Common::List<T>::iterator _it;
|
||||
public:
|
||||
reverse_iterator(typename Common::List<T>::iterator it) : _it(it) {
|
||||
}
|
||||
reverse_iterator() {
|
||||
}
|
||||
|
||||
T operator*() const {
|
||||
return *_it;
|
||||
}
|
||||
|
||||
reverse_iterator &operator++() {
|
||||
--_it;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const reverse_iterator &rhs) {
|
||||
return _it == rhs._it;
|
||||
}
|
||||
bool operator!=(const reverse_iterator &rhs) {
|
||||
return _it != rhs._it;
|
||||
}
|
||||
};
|
||||
public:
|
||||
typename Common::List<T>::iterator insert(typename Common::List<T>::iterator pos,
|
||||
const T &element) {
|
||||
Common::List<T>::insert(pos, element);
|
||||
return pos;
|
||||
}
|
||||
|
||||
reverse_iterator rbegin() {
|
||||
return reverse_iterator(Common::List<T>::reverse_begin());
|
||||
}
|
||||
reverse_iterator rend() {
|
||||
return reverse_iterator(Common::List<T>::end());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
53
engines/ags/std/map.h
Normal file
53
engines/ags/std/map.h
Normal file
@ -0,0 +1,53 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_MAP_H
|
||||
#define AGS_STD_MAP_H
|
||||
|
||||
#include "common/hashmap.h"
|
||||
#include "ags/std/utility.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
template<class Key, class Val, class HashFunc = Common::Hash<Key>,
|
||||
class EqualFunc = Common::EqualTo<Key> >
|
||||
class map : public Common::HashMap<Key, Val, HashFunc, EqualFunc> {
|
||||
public:
|
||||
void insert(pair<Key, Val> elem) {
|
||||
this->operator[](elem.first) = elem.second;
|
||||
}
|
||||
};
|
||||
|
||||
template<class Key, class Val, class HashFunc = Common::Hash<Key>,
|
||||
class EqualFunc = Common::EqualTo<Key> >
|
||||
class unordered_map : public Common::HashMap<Key, Val, HashFunc, EqualFunc> {
|
||||
public:
|
||||
void insert(pair<Key, Val> elem) {
|
||||
this->operator[](elem.first) = elem.second;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
44
engines/ags/std/memory.h
Normal file
44
engines/ags/std/memory.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_MEMORY_H
|
||||
#define AGS_STD_MEMORY_H
|
||||
|
||||
#include "common/ptr.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
template<class T>
|
||||
using shared_ptr = Common::SharedPtr<T>;
|
||||
|
||||
template<class T>
|
||||
using weak_ptr = Common::WeakPtr<T>;
|
||||
|
||||
template<typename T, class DL = Common::DefaultDeleter<T> >
|
||||
using unique_ptr = Common::ScopedPtr<T, DL>;
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
37
engines/ags/std/mutex.h
Normal file
37
engines/ags/std/mutex.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_MUTEX_H
|
||||
#define AGS_STD_MUTEX_H
|
||||
|
||||
#include "common/mutex.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
class recursive_mutex : public Common::Mutex {
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
123
engines/ags/std/set.h
Normal file
123
engines/ags/std/set.h
Normal file
@ -0,0 +1,123 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_SET_H
|
||||
#define AGS_STD_SET_H
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
template<class T>
|
||||
class set {
|
||||
struct Comparitor {
|
||||
bool operator()(const T &a, const T &b) const {
|
||||
return a == b;
|
||||
}
|
||||
};
|
||||
|
||||
class Items : public Common::Array<T> {
|
||||
public:
|
||||
void swap(Items &arr) {
|
||||
SWAP(this->_capacity, arr._capacity);
|
||||
SWAP(this->_size, arr._size);
|
||||
SWAP(this->_storage, arr._storage);
|
||||
}
|
||||
};
|
||||
private:
|
||||
Items _items;
|
||||
Comparitor _comparitor;
|
||||
public:
|
||||
typedef T *iterator;
|
||||
typedef const T *const_iterator;
|
||||
|
||||
iterator begin() { return _items.begin(); }
|
||||
iterator end() { return _items.end(); }
|
||||
const_iterator begin() const { return _items.begin(); }
|
||||
const_iterator end() const { return _items.end(); }
|
||||
|
||||
/**
|
||||
* Clear the set
|
||||
*/
|
||||
void clear() {
|
||||
_items.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a new item
|
||||
*/
|
||||
void insert(T val) {
|
||||
_items.push_back(val);
|
||||
Common::sort(begin(), end(), _comparitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts a range of items
|
||||
*/
|
||||
void insert(iterator first, iterator last) {
|
||||
for (; first != last; ++first)
|
||||
_items.push_back(*first);
|
||||
Common::sort(begin(), end(), _comparitor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swaps a set
|
||||
*/
|
||||
void swap(set<T> &arr) {
|
||||
_items.swap(arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an item
|
||||
*/
|
||||
iterator find(const T item) {
|
||||
iterator it = begin();
|
||||
for (; it != end() && *it != item; ++it) {}
|
||||
return it;
|
||||
}
|
||||
const_iterator find(const T item) const {
|
||||
const_iterator it = begin();
|
||||
for (; it != end() && *it != item; ++it) {
|
||||
}
|
||||
return it;
|
||||
}
|
||||
bool empty() const {
|
||||
return _items.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of matching entries
|
||||
*/
|
||||
size_t count(const T item) const {
|
||||
size_t total = 0;
|
||||
for (const_iterator it = begin(); it != end(); ++it) {
|
||||
if (*it == item)
|
||||
++total;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
61
engines/ags/std/thread.h
Normal file
61
engines/ags/std/thread.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_THREAD_H
|
||||
#define AGS_STD_THREAD_H
|
||||
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
class thread {
|
||||
public:
|
||||
template <class _Fn, class... _Args>
|
||||
explicit thread(_Fn &&_Fx, _Args &&... _Ax) {
|
||||
warning("TODO: thread::constructor");
|
||||
}
|
||||
|
||||
thread() {
|
||||
warning("TODO: thread::constructor");
|
||||
}
|
||||
|
||||
void join() {
|
||||
warning("TODO: thread::join");
|
||||
}
|
||||
bool joinable() const {
|
||||
warning("TODO: thread::joinable");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class this_thread {
|
||||
public:
|
||||
static void yield() {
|
||||
warning("TODO: this_thread::yield");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
51
engines/ags/std/type_traits.h
Normal file
51
engines/ags/std/type_traits.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_TYPE_TRAITS_H
|
||||
#define AGS_STD_TYPE_TRAITS_H
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
// STRUCT TEMPLATE remove_extent
|
||||
template <class _Ty>
|
||||
struct remove_extent { // remove array extent
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template <class _Ty, size_t _Ix>
|
||||
struct remove_extent<_Ty[_Ix]> {
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template <class _Ty>
|
||||
struct remove_extent<_Ty[]> {
|
||||
using type = _Ty;
|
||||
};
|
||||
|
||||
template <class _Ty>
|
||||
using remove_extent_t = typename remove_extent<_Ty>::type;
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
48
engines/ags/std/utility.h
Normal file
48
engines/ags/std/utility.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_UTILITY_H
|
||||
#define AGS_STD_UTILITY_H
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
template<class T1, class T2>
|
||||
struct pair {
|
||||
T1 first;
|
||||
T2 second;
|
||||
|
||||
pair() {
|
||||
}
|
||||
pair(T1 first_, T2 second_) : first(first_), second(second_) {
|
||||
}
|
||||
};
|
||||
|
||||
template< class T1, class T2 >
|
||||
pair<T1, T2> make_pair(T1 first, T2 second) {
|
||||
return pair<T1, T2>(first, second);
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
173
engines/ags/std/vector.h
Normal file
173
engines/ags/std/vector.h
Normal file
@ -0,0 +1,173 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_VECTOR_H
|
||||
#define AGS_STD_VECTOR_H
|
||||
|
||||
#include "common/array.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
template<class T>
|
||||
class vector : public Common::Array<T> {
|
||||
public:
|
||||
struct reverse_iterator {
|
||||
private:
|
||||
vector<T> *_owner;
|
||||
int _index;
|
||||
public:
|
||||
reverse_iterator(vector<T> *owner, int index) : _owner(owner), _index(index) {
|
||||
}
|
||||
reverse_iterator() : _owner(0), _index(-1) {
|
||||
}
|
||||
|
||||
T &operator*() {
|
||||
return (*_owner)[_index];
|
||||
}
|
||||
|
||||
reverse_iterator &operator++() {
|
||||
--_index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const reverse_iterator &rhs) {
|
||||
return _owner == rhs._owner && _index == rhs._index;
|
||||
}
|
||||
bool operator!=(const reverse_iterator &rhs) {
|
||||
return !operator==(rhs);
|
||||
}
|
||||
};
|
||||
|
||||
struct const_reverse_iterator {
|
||||
private:
|
||||
const vector<T> *_owner;
|
||||
int _index;
|
||||
public:
|
||||
const_reverse_iterator(const vector<T> *owner, int index) : _owner(owner), _index(index) {
|
||||
}
|
||||
const_reverse_iterator() : _owner(0), _index(-1) {
|
||||
}
|
||||
|
||||
const T operator*() const {
|
||||
return (*_owner)[_index];
|
||||
}
|
||||
|
||||
const_reverse_iterator &operator++() {
|
||||
--_index;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const const_reverse_iterator &rhs) {
|
||||
return _owner == rhs._owner && _index == rhs._index;
|
||||
}
|
||||
bool operator!=(const const_reverse_iterator &rhs) {
|
||||
return !operator==(rhs);
|
||||
}
|
||||
};
|
||||
public:
|
||||
typedef T reference;
|
||||
typedef const T const_reference;
|
||||
|
||||
vector() : Common::Array<T>() {
|
||||
}
|
||||
vector(size_t newSize) : Common::Array<T>() {
|
||||
Common::Array<T>::resize(newSize);
|
||||
}
|
||||
vector(size_t newSize, const T elem) {
|
||||
resize(newSize, elem);
|
||||
}
|
||||
|
||||
typename Common::Array<T>::iterator erase(typename Common::Array<T>::iterator pos) {
|
||||
return Common::Array<T>::erase(pos);
|
||||
}
|
||||
|
||||
typename Common::Array<T>::iterator erase(typename Common::Array<T>::iterator first,
|
||||
typename Common::Array<T>::iterator last) {
|
||||
Common::copy(last, this->_storage + this->_size, first);
|
||||
|
||||
int count = (last - first);
|
||||
this->_size -= count;
|
||||
|
||||
// We also need to destroy the objects beyond the new size
|
||||
for (uint idx = this->_size; idx < (this->_size + count); ++idx)
|
||||
this->_storage[idx].~T();
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
void swap(vector &arr) {
|
||||
SWAP(this->_capacity, arr._capacity);
|
||||
SWAP(this->_size, arr._size);
|
||||
SWAP(this->_storage, arr._storage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates the array so that the item pointed to by the iterator becomes
|
||||
* the first item, and the predeceding item becomes the last one
|
||||
*/
|
||||
void rotate(Common::Array<T>::iterator &it) {
|
||||
if (it != Common::Array<T>::end()) {
|
||||
size_t count = it - Common::Array<T>::begin();
|
||||
for (size_t ctr = 0; ctr < count; ++ctr) {
|
||||
Common::Array<T>::push_back(Common::Array<T>::front());
|
||||
Common::Array<T>::remove_at(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reverse_iterator rbegin() {
|
||||
return reverse_iterator(this, (int)Common::Array<T>::size() - 1);
|
||||
}
|
||||
reverse_iterator rend() {
|
||||
return reverse_iterator(this, -1);
|
||||
}
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(this, (int)Common::Array<T>::size() - 1);
|
||||
}
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(this, -1);
|
||||
}
|
||||
|
||||
void pop_front() {
|
||||
Common::Array<T>::remove_at(0);
|
||||
}
|
||||
|
||||
void resize(size_t newSize) {
|
||||
Common::Array<T>::resize(newSize);
|
||||
}
|
||||
void resize(size_t newSize, const T elem) {
|
||||
size_t oldSize = Common::Array<T>::size();
|
||||
resize(newSize);
|
||||
for (size_t idx = oldSize; idx < newSize; ++idx)
|
||||
this->operator[](idx) = elem;
|
||||
}
|
||||
|
||||
T at(size_t index) const {
|
||||
return (*this)[index];
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
34
engines/ags/std/xutility.h
Normal file
34
engines/ags/std/xutility.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STD_XUTILITY_H
|
||||
#define AGS_STD_XUTILITY_H
|
||||
|
||||
#include "common/algorithm.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace std {
|
||||
|
||||
} // namespace std
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
34
engines/ags/stubs/allegro.cpp
Normal file
34
engines/ags/stubs/allegro.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
int install_allegro() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void allegro_exit() {
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
49
engines/ags/stubs/allegro.h
Normal file
49
engines/ags/stubs/allegro.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_H
|
||||
#define AGS_STUBS_ALLEGRO_H
|
||||
|
||||
#include "ags/stubs/allegro/alconfig.h"
|
||||
#include "ags/stubs/allegro/base.h"
|
||||
#include "ags/stubs/allegro/color.h"
|
||||
#include "ags/stubs/allegro/config.h"
|
||||
#include "ags/stubs/allegro/digi.h"
|
||||
#include "ags/stubs/allegro/error.h"
|
||||
#include "ags/stubs/allegro/file.h"
|
||||
#include "ags/stubs/allegro/fixed.h"
|
||||
#include "ags/stubs/allegro/gfx.h"
|
||||
#include "ags/stubs/allegro/keyboard.h"
|
||||
#include "ags/stubs/allegro/midi.h"
|
||||
#include "ags/stubs/allegro/mouse.h"
|
||||
#include "ags/stubs/allegro/sound.h"
|
||||
#include "ags/stubs/allegro/system.h"
|
||||
#include "ags/stubs/allegro/unicode.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
extern int install_allegro();
|
||||
extern void allegro_exit();
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
79
engines/ags/stubs/allegro/alconfig.h
Normal file
79
engines/ags/stubs/allegro/alconfig.h
Normal file
@ -0,0 +1,79 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_ALCONFIG_H
|
||||
#define AGS_STUBS_ALLEGRO_ALCONFIG_H
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
|
||||
#ifndef INLINE
|
||||
#define INLINE
|
||||
#endif
|
||||
|
||||
#ifndef RET_VOLATILE
|
||||
#define RET_VOLATILE volatile
|
||||
#endif
|
||||
|
||||
#ifndef ZERO_SIZE_ARRAY
|
||||
#define ZERO_SIZE_ARRAY(type, name) type name[]
|
||||
#endif
|
||||
|
||||
#ifndef AL_CONST
|
||||
#define AL_CONST
|
||||
#endif
|
||||
|
||||
#ifndef AL_VAR
|
||||
#define AL_VAR(type, name) extern type name
|
||||
#endif
|
||||
|
||||
#ifndef AL_ARRAY
|
||||
#define AL_ARRAY(type, name) extern type name[]
|
||||
#endif
|
||||
|
||||
#ifndef AL_FUNC
|
||||
#define AL_FUNC(type, name, args) type name args
|
||||
#endif
|
||||
|
||||
#ifndef AL_PRINTFUNC
|
||||
#define AL_PRINTFUNC(type, name, args, a, b) AL_FUNC(type, name, args)
|
||||
#endif
|
||||
|
||||
#ifndef AL_METHOD
|
||||
#define AL_METHOD(type, name, args) type (*name) args
|
||||
#endif
|
||||
|
||||
#ifndef AL_FUNCPTR
|
||||
#define AL_FUNCPTR(type, name, args) extern type (*name) args
|
||||
#endif
|
||||
|
||||
#ifndef AL_FUNCPTRARRAY
|
||||
#define AL_FUNCPTRARRAY(type, name, args) extern type (*name[]) args
|
||||
#endif
|
||||
|
||||
#ifndef AL_INLINE
|
||||
#define AL_INLINE(type, name, args, code) type name args;
|
||||
#endif
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
60
engines/ags/stubs/allegro/base.h
Normal file
60
engines/ags/stubs/allegro/base.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_BASE_H
|
||||
#define AGS_STUBS_ALLEGRO_BASE_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/algorithm.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
#define ALLEGRO_VERSION 4
|
||||
#define ALLEGRO_SUB_VERSION 4
|
||||
#define ALLEGRO_WIP_VERSION 2
|
||||
#define ALLEGRO_VERSION_STR "4.4.2"
|
||||
#define ALLEGRO_DATE_STR "2011"
|
||||
#define ALLEGRO_DATE 20110519 /* yyyymmdd */
|
||||
|
||||
/* Returns the median of x, y, z */
|
||||
#define MID(x,y,z) ((x) > (y) ? ((y) > (z) ? (y) : ((x) > (z) ? \
|
||||
(z) : (x))) : ((y) > (z) ? ((z) > (x) ? (z) : \
|
||||
(x)): (y)))
|
||||
|
||||
#define AL_ID MKTAG
|
||||
|
||||
extern int *allegro_errno;
|
||||
|
||||
/**
|
||||
* info about a hardware driver
|
||||
*/
|
||||
struct _DRIVER_INFO {
|
||||
int id; /* integer ID */
|
||||
void *driver; /* the driver structure */
|
||||
int autodetect; /* set to allow autodetection */
|
||||
};
|
||||
|
||||
#define AL_FUNC(type, name, args) type name args
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
68
engines/ags/stubs/allegro/color.cpp
Normal file
68
engines/ags/stubs/allegro/color.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/color.h"
|
||||
#include "common/textconsole.h"
|
||||
#include "common/system.h"
|
||||
#include "graphics/palette.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
int _rgb_r_shift_15 = 0;
|
||||
int _rgb_g_shift_15 = 0;
|
||||
int _rgb_b_shift_15 = 0;
|
||||
int _rgb_r_shift_16 = 0;
|
||||
int _rgb_g_shift_16 = 0;
|
||||
int _rgb_b_shift_16 = 0;
|
||||
int _rgb_r_shift_24 = 0;
|
||||
int _rgb_g_shift_24 = 0;
|
||||
int _rgb_b_shift_24 = 0;
|
||||
int _rgb_r_shift_32 = 0;
|
||||
int _rgb_g_shift_32 = 0;
|
||||
int _rgb_b_shift_32 = 0;
|
||||
int _rgb_a_shift_32 = 0;
|
||||
|
||||
int bestfit_color(const PALETTE pal, int r, int g, int b) {
|
||||
error("TODO: bestfit_color");
|
||||
}
|
||||
|
||||
void set_color(int idx, const RGB *p) {
|
||||
g_system->getPaletteManager()->setPalette((const byte *)p, idx, 1);
|
||||
}
|
||||
|
||||
void set_palette(const PALETTE p) {
|
||||
|
||||
}
|
||||
|
||||
void set_palette_range(const PALETTE p, int from, int to, int retracesync) {
|
||||
byte palette[256 * 3];
|
||||
byte *destP = palette;
|
||||
for (int i = 0; i < 256; ++i, destP += 3) {
|
||||
destP[0] = p->r;
|
||||
destP[1] = p->g;
|
||||
destP[2] = p->b;
|
||||
}
|
||||
|
||||
g_system->getPaletteManager()->setPalette(&palette[from], from, to - from + 1);
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
66
engines/ags/stubs/allegro/color.h
Normal file
66
engines/ags/stubs/allegro/color.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_COLOR_H
|
||||
#define AGS_STUBS_ALLEGRO_COLOR_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "ags/stubs/allegro/alconfig.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
#include "common/pack-start.h" // START STRUCT PACKING
|
||||
|
||||
struct color {
|
||||
byte r, g, b;
|
||||
} PACKED_STRUCT;
|
||||
|
||||
typedef color RGB;
|
||||
typedef color PALETTE[256];
|
||||
|
||||
#include "common/pack-end.h" // END STRUCT PACKING
|
||||
|
||||
//define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
|
||||
|
||||
extern int bestfit_color(const PALETTE pal, int r, int g, int b);
|
||||
|
||||
extern int _rgb_r_shift_15;
|
||||
extern int _rgb_g_shift_15;
|
||||
extern int _rgb_b_shift_15;
|
||||
extern int _rgb_r_shift_16;
|
||||
extern int _rgb_g_shift_16;
|
||||
extern int _rgb_b_shift_16;
|
||||
extern int _rgb_r_shift_24;
|
||||
extern int _rgb_g_shift_24;
|
||||
extern int _rgb_b_shift_24;
|
||||
extern int _rgb_r_shift_32;
|
||||
extern int _rgb_g_shift_32;
|
||||
extern int _rgb_b_shift_32;
|
||||
extern int _rgb_a_shift_32;
|
||||
|
||||
AL_FUNC(void, set_color, (int idx, AL_CONST RGB *p));
|
||||
AL_FUNC(void, set_palette, (AL_CONST PALETTE p));
|
||||
AL_FUNC(void, set_palette_range, (AL_CONST PALETTE p, int from, int to, int retracesync));
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
32
engines/ags/stubs/allegro/config.cpp
Normal file
32
engines/ags/stubs/allegro/config.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/config.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
void override_config_data(const char *data, int length) {
|
||||
// No implementation
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
32
engines/ags/stubs/allegro/config.h
Normal file
32
engines/ags/stubs/allegro/config.h
Normal file
@ -0,0 +1,32 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_CONFIG_H
|
||||
#define AGS_STUBS_ALLEGRO_CONFIG_H
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
extern void override_config_data(const char *data, int length);
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
40
engines/ags/stubs/allegro/digi.cpp
Normal file
40
engines/ags/stubs/allegro/digi.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/digi.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
DIGI_DRIVER *digi_driver;
|
||||
|
||||
DIGI_DRIVER *digi_input_driver;
|
||||
|
||||
int digi_card;
|
||||
|
||||
int digi_input_card;
|
||||
|
||||
|
||||
int detect_digi_driver(int driver_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
145
engines/ags/stubs/allegro/digi.h
Normal file
145
engines/ags/stubs/allegro/digi.h
Normal file
@ -0,0 +1,145 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_DIGI_H
|
||||
#define AGS_STUBS_ALLEGRO_DIGI_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "ags/stubs/allegro/base.h"
|
||||
#include "ags/stubs/allegro/alconfig.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
|
||||
#define DIGI_VOICES 64 /* Theoretical maximums: */
|
||||
/* actual drivers may not be */
|
||||
/* able to handle this many */
|
||||
|
||||
/* a sample */
|
||||
struct SAMPLE {
|
||||
int bits; /* 8 or 16 */
|
||||
int stereo; /* sample type flag */
|
||||
int freq; /* sample frequency */
|
||||
int priority; /* 0-255 */
|
||||
unsigned long len; /* length (in samples) */
|
||||
unsigned long loop_start; /* loop start position */
|
||||
unsigned long loop_end; /* loop finish position */
|
||||
unsigned long param; /* for internal use by the driver */
|
||||
void *data; /* sample data */
|
||||
};
|
||||
|
||||
|
||||
#define DIGI_AUTODETECT -1 /* for passing to install_sound() */
|
||||
#define DIGI_NONE 0
|
||||
|
||||
/* driver for playing digital sfx */
|
||||
struct DIGI_DRIVER {
|
||||
int id; /* driver ID code */
|
||||
AL_CONST char *name; /* driver name */
|
||||
AL_CONST char *desc; /* description string */
|
||||
AL_CONST char *ascii_name; /* ASCII format name string */
|
||||
int voices; /* available voices */
|
||||
int basevoice; /* voice number offset */
|
||||
int max_voices; /* maximum voices we can support */
|
||||
int def_voices; /* default number of voices to use */
|
||||
|
||||
/* setup routines */
|
||||
AL_METHOD(int, detect, (int input));
|
||||
AL_METHOD(int, init, (int input, int voices));
|
||||
AL_METHOD(void, exit, (int input));
|
||||
AL_METHOD(int, set_mixer_volume, (int volume));
|
||||
AL_METHOD(int, get_mixer_volume, (void));
|
||||
|
||||
/* for use by the audiostream functions */
|
||||
AL_METHOD(void *, lock_voice, (int voice, int start, int end));
|
||||
AL_METHOD(void, unlock_voice, (int voice));
|
||||
AL_METHOD(int, buffer_size, (void));
|
||||
|
||||
/* voice control functions */
|
||||
AL_METHOD(void, init_voice, (int voice, AL_CONST SAMPLE *sample));
|
||||
AL_METHOD(void, release_voice, (int voice));
|
||||
AL_METHOD(void, start_voice, (int voice));
|
||||
AL_METHOD(void, stop_voice, (int voice));
|
||||
AL_METHOD(void, loop_voice, (int voice, int playmode));
|
||||
|
||||
/* position control functions */
|
||||
AL_METHOD(int, get_position, (int voice));
|
||||
AL_METHOD(void, set_position, (int voice, int position));
|
||||
|
||||
/* volume control functions */
|
||||
AL_METHOD(int, get_volume, (int voice));
|
||||
AL_METHOD(void, set_volume, (int voice, int volume));
|
||||
AL_METHOD(void, ramp_volume, (int voice, int tyme, int endvol));
|
||||
AL_METHOD(void, stop_volume_ramp, (int voice));
|
||||
|
||||
/* pitch control functions */
|
||||
AL_METHOD(int, get_frequency, (int voice));
|
||||
AL_METHOD(void, set_frequency, (int voice, int frequency));
|
||||
AL_METHOD(void, sweep_frequency, (int voice, int tyme, int endfreq));
|
||||
AL_METHOD(void, stop_frequency_sweep, (int voice));
|
||||
|
||||
/* pan control functions */
|
||||
AL_METHOD(int, get_pan, (int voice));
|
||||
AL_METHOD(void, set_pan, (int voice, int pan));
|
||||
AL_METHOD(void, sweep_pan, (int voice, int tyme, int endpan));
|
||||
AL_METHOD(void, stop_pan_sweep, (int voice));
|
||||
|
||||
/* effect control functions */
|
||||
AL_METHOD(void, set_echo, (int voice, int strength, int delay));
|
||||
AL_METHOD(void, set_tremolo, (int voice, int rate, int depth));
|
||||
AL_METHOD(void, set_vibrato, (int voice, int rate, int depth));
|
||||
|
||||
/* input functions */
|
||||
int rec_cap_bits;
|
||||
int rec_cap_stereo;
|
||||
AL_METHOD(int, rec_cap_rate, (int bits, int stereo));
|
||||
AL_METHOD(int, rec_cap_parm, (int rate, int bits, int stereo));
|
||||
AL_METHOD(int, rec_source, (int source));
|
||||
AL_METHOD(int, rec_start, (int rate, int bits, int stereo));
|
||||
AL_METHOD(void, rec_stop, (void));
|
||||
AL_METHOD(int, rec_read, (void *buf));
|
||||
};
|
||||
|
||||
AL_ARRAY(_DRIVER_INFO, _digi_driver_list);
|
||||
|
||||
/* macros for constructing the driver lists */
|
||||
#define BEGIN_DIGI_DRIVER_LIST \
|
||||
_DRIVER_INFO _digi_driver_list[] = \
|
||||
{
|
||||
|
||||
#define END_DIGI_DRIVER_LIST \
|
||||
{ 0, nullptr, 0 } \
|
||||
};
|
||||
|
||||
AL_VAR(DIGI_DRIVER *, digi_driver);
|
||||
|
||||
AL_VAR(DIGI_DRIVER *, digi_input_driver);
|
||||
|
||||
AL_VAR(int, digi_card);
|
||||
|
||||
AL_VAR(int, digi_input_card);
|
||||
|
||||
AL_FUNC(int, detect_digi_driver, (int driver_id));
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
28
engines/ags/stubs/allegro/error.cpp
Normal file
28
engines/ags/stubs/allegro/error.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
static int allegro_error;
|
||||
extern int *allegro_errno = &allegro_error;
|
||||
|
||||
} // namespace AGS3
|
82
engines/ags/stubs/allegro/error.h
Normal file
82
engines/ags/stubs/allegro/error.h
Normal file
@ -0,0 +1,82 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_ERROR_H
|
||||
#define AGS_STUBS_ALLEGRO_ERROR_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
|
||||
|
||||
// Error codes
|
||||
#define EPERM 1
|
||||
#define ENOENT 2
|
||||
#define ESRCH 3
|
||||
#define EINTR 4
|
||||
#define EIO 5
|
||||
#define ENXIO 6
|
||||
#define E2BIG 7
|
||||
#define ENOEXEC 8
|
||||
#define EBADF 9
|
||||
#define ECHILD 10
|
||||
#define EAGAIN 11
|
||||
#define ENOMEM 12
|
||||
#define EACCES 13
|
||||
#define EFAULT 14
|
||||
#define EBUSY 16
|
||||
#define EEXIST 17
|
||||
#define EXDEV 18
|
||||
#define ENODEV 19
|
||||
#define ENOTDIR 20
|
||||
#define EISDIR 21
|
||||
#define ENFILE 23
|
||||
#define EMFILE 24
|
||||
#define ENOTTY 25
|
||||
#define EFBIG 27
|
||||
#define ENOSPC 28
|
||||
#define ESPIPE 29
|
||||
#define EROFS 30
|
||||
#define EMLINK 31
|
||||
#define EPIPE 32
|
||||
#define EDOM 33
|
||||
#define EDEADLK 36
|
||||
#define ENAMETOOLONG 38
|
||||
#define ENOLCK 39
|
||||
#define ENOSYS 40
|
||||
#define ENOTEMPTY 41
|
||||
|
||||
// Error codes used in the Secure CRT functions
|
||||
#ifndef RC_INVOKED
|
||||
#define _SECURECRT_ERRCODE_VALUES_DEFINED
|
||||
#define EINVAL 22
|
||||
#define ERANGE 34
|
||||
#define EILSEQ 42
|
||||
#define STRUNCATE 80
|
||||
#endif
|
||||
|
||||
extern int *allegro_errno;
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
57
engines/ags/stubs/allegro/file.cpp
Normal file
57
engines/ags/stubs/allegro/file.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/file.h"
|
||||
#include "common/str.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
char *fix_filename_case(char *path) {
|
||||
return path;
|
||||
}
|
||||
|
||||
char *fix_filename_slashes(char *path) {
|
||||
return path;
|
||||
}
|
||||
|
||||
char *append_filename(char *dest, const char *path, const char *filename, int size) {
|
||||
strncpy(dest, path, size);
|
||||
strncat(dest, filename, size);
|
||||
return dest;
|
||||
}
|
||||
|
||||
char *canonicalize_filename(char *dest, const char *filename, int size) {
|
||||
strncpy(dest, filename, size);
|
||||
return dest;
|
||||
}
|
||||
|
||||
char *make_relative_filename(char *dest, const char *path, const char *filename, int size) {
|
||||
strncpy(dest, filename, size);
|
||||
return dest;
|
||||
}
|
||||
|
||||
int is_relative_filename(const char *filename) {
|
||||
Common::String fname(filename);
|
||||
return !fname.contains('/') && !fname.contains('\\') ? 0 : -1;
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
42
engines/ags/stubs/allegro/file.h
Normal file
42
engines/ags/stubs/allegro/file.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_FILE_H
|
||||
#define AGS_STUBS_ALLEGRO_FILE_H
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
struct PACKFILE {
|
||||
// TODO: PACKFILE handling
|
||||
int dummy;
|
||||
};
|
||||
|
||||
extern char *fix_filename_case(char *path);
|
||||
extern char *fix_filename_slashes(char *path);
|
||||
extern char *append_filename(char *dest, const char *path, const char *filename, int size);
|
||||
extern char *canonicalize_filename(char *dest, const char *filename, int size);
|
||||
extern char *make_relative_filename(char *dest, const char *path, const char *filename, int size);
|
||||
extern int is_relative_filename(const char *filename);
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
178
engines/ags/stubs/allegro/fixed.cpp
Normal file
178
engines/ags/stubs/allegro/fixed.cpp
Normal file
@ -0,0 +1,178 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/fixed.h"
|
||||
#include "ags/stubs/allegro/error.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
fixed fixtorad_r;
|
||||
fixed radtofix_r;
|
||||
|
||||
fixed ftofix(double x) {
|
||||
if (x > 32767.0) {
|
||||
*allegro_errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
}
|
||||
|
||||
if (x < -32767.0) {
|
||||
*allegro_errno = ERANGE;
|
||||
return (fixed)-0x7FFFFFFF;
|
||||
}
|
||||
|
||||
return (fixed)(x * 65536.0 + (x < 0 ? -0.5 : 0.5));
|
||||
}
|
||||
|
||||
double fixtof(fixed x) {
|
||||
return (double)x / 65536.0;
|
||||
}
|
||||
|
||||
fixed fixadd(fixed x, fixed y) {
|
||||
fixed result = x + y;
|
||||
|
||||
if (result >= 0) {
|
||||
if ((x < 0) && (y < 0)) {
|
||||
*allegro_errno = ERANGE;
|
||||
return (fixed)-0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
if ((x > 0) && (y > 0)) {
|
||||
*allegro_errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
fixed fixsub(fixed x, fixed y) {
|
||||
fixed result = x - y;
|
||||
|
||||
if (result >= 0) {
|
||||
if ((x < 0) && (y > 0)) {
|
||||
*allegro_errno = ERANGE;
|
||||
return (fixed)-0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
if ((x > 0) && (y < 0)) {
|
||||
*allegro_errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
}
|
||||
else
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
fixed fixmul(fixed x, fixed y) {
|
||||
int64 lx = x;
|
||||
int64 ly = y;
|
||||
int64 lres = (lx * ly);
|
||||
|
||||
if (lres > 0x7FFFFFFF0000LL) {
|
||||
*allegro_errno = ERANGE;
|
||||
return 0x7FFFFFFF;
|
||||
} else if (lres < -0x7FFFFFFF0000LL) {
|
||||
*allegro_errno = ERANGE;
|
||||
return 0x80000000;
|
||||
} else {
|
||||
int res = lres >> 16;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
fixed fixdiv(fixed x, fixed y) {
|
||||
if (y == 0) {
|
||||
*allegro_errno = ERANGE;
|
||||
return (fixed)(x < 0) ? -0x7FFFFFFF : 0x7FFFFFFF;
|
||||
} else
|
||||
return ftofix(fixtof(x) / fixtof(y));
|
||||
}
|
||||
|
||||
int fixfloor(fixed x) {
|
||||
/* (x >> 16) is not portable */
|
||||
if (x >= 0)
|
||||
return (x >> 16);
|
||||
else
|
||||
return ~((~x) >> 16);
|
||||
}
|
||||
|
||||
|
||||
int fixceil(fixed x) {
|
||||
if (x > 0x7FFF0000) {
|
||||
*allegro_errno = ERANGE;
|
||||
return 0x7FFF;
|
||||
}
|
||||
|
||||
return fixfloor(x + 0xFFFF);
|
||||
}
|
||||
|
||||
fixed itofix(int x) {
|
||||
return x << 16;
|
||||
}
|
||||
|
||||
|
||||
int fixtoi(fixed x) {
|
||||
return fixfloor(x) + ((x & 0x8000) >> 15);
|
||||
}
|
||||
|
||||
|
||||
fixed fixcos(fixed x) {
|
||||
return _cos_tbl[((x + 0x4000) >> 15) & 0x1FF];
|
||||
}
|
||||
|
||||
|
||||
fixed fixsin(fixed x) {
|
||||
return _cos_tbl[((x - 0x400000 + 0x4000) >> 15) & 0x1FF];
|
||||
}
|
||||
|
||||
|
||||
fixed fixtan(fixed x) {
|
||||
return _tan_tbl[((x + 0x4000) >> 15) & 0xFF];
|
||||
}
|
||||
|
||||
|
||||
fixed fixacos(fixed x) {
|
||||
if ((x < -65536) || (x > 65536)) {
|
||||
*allegro_errno = EDOM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _acos_tbl[(x + 65536 + 127) >> 8];
|
||||
}
|
||||
|
||||
|
||||
fixed fixasin(fixed x) {
|
||||
if ((x < -65536) || (x > 65536)) {
|
||||
*allegro_errno = EDOM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0x00400000 - _acos_tbl[(x + 65536 + 127) >> 8];
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
63
engines/ags/stubs/allegro/fixed.h
Normal file
63
engines/ags/stubs/allegro/fixed.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_FIXED_H
|
||||
#define AGS_STUBS_ALLEGRO_FIXED_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
typedef uint32 fixed;
|
||||
|
||||
extern fixed fixtorad_r;
|
||||
extern fixed radtofix_r;
|
||||
extern fixed _cos_tbl[];
|
||||
extern fixed _tan_tbl[];
|
||||
extern fixed _acos_tbl[];
|
||||
|
||||
extern fixed ftofix(double x);
|
||||
extern double fixtof(fixed x);
|
||||
extern fixed fixadd(fixed x, fixed y);
|
||||
extern fixed fixsub(fixed x, fixed y);
|
||||
extern fixed fixmul(fixed x, fixed y);
|
||||
extern fixed fixdiv(fixed x, fixed y);
|
||||
extern int fixfloor(fixed x);
|
||||
extern int fixceil(fixed x);
|
||||
extern fixed itofix(int x);
|
||||
extern int fixtoi(fixed x);
|
||||
extern fixed fixcos(fixed x);
|
||||
extern fixed fixsin(fixed x);
|
||||
extern fixed fixtan(fixed x);
|
||||
extern fixed fixacos(fixed x);
|
||||
extern fixed fixasin(fixed x);
|
||||
|
||||
#if 0
|
||||
extern fixed fixsqrt(fixed x);
|
||||
extern fixed fixhypot(fixed x, fixed y);
|
||||
extern fixed fixatan(fixed x);
|
||||
extern fixed fixatan2(fixed y, fixed x);
|
||||
#endif
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
43
engines/ags/stubs/allegro/gfx.cpp
Normal file
43
engines/ags/stubs/allegro/gfx.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/gfx.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
int color_conversion;
|
||||
|
||||
void set_color_conversion(int mode) {
|
||||
color_conversion = mode;
|
||||
}
|
||||
|
||||
int get_color_conversion() {
|
||||
return color_conversion;
|
||||
}
|
||||
|
||||
int set_gfx_mode(int card, int w, int h, int v_w, int v_h) {
|
||||
error("TODO: set_gfx_mode");
|
||||
}
|
||||
|
||||
|
||||
} // namespace AGS3
|
176
engines/ags/stubs/allegro/gfx.h
Normal file
176
engines/ags/stubs/allegro/gfx.h
Normal file
@ -0,0 +1,176 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_GRAPHICS_H
|
||||
#define AGS_STUBS_ALLEGRO_GRAPHICS_H
|
||||
|
||||
#include "graphics/managed_surface.h"
|
||||
#include "ags/stubs/allegro/base.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
#define GFX_TEXT -1
|
||||
#define GFX_AUTODETECT 0
|
||||
#define GFX_AUTODETECT_FULLSCREEN 1
|
||||
#define GFX_AUTODETECT_WINDOWED 2
|
||||
#define GFX_SAFE AL_ID('S','A','F','E')
|
||||
#define GFX_NONE AL_ID('N','O','N','E')
|
||||
|
||||
/* drawing modes for draw_sprite_ex() */
|
||||
#define DRAW_SPRITE_NORMAL 0
|
||||
#define DRAW_SPRITE_LIT 1
|
||||
#define DRAW_SPRITE_TRANS 2
|
||||
|
||||
/* flipping modes for draw_sprite_ex() */
|
||||
#define DRAW_SPRITE_NO_FLIP 0x0
|
||||
#define DRAW_SPRITE_H_FLIP 0x1
|
||||
#define DRAW_SPRITE_V_FLIP 0x2
|
||||
#define DRAW_SPRITE_VH_FLIP 0x3
|
||||
|
||||
/* Blender mode defines, for the gfx_driver->set_blender_mode() function */
|
||||
#define blender_mode_none 0
|
||||
#define blender_mode_trans 1
|
||||
#define blender_mode_add 2
|
||||
#define blender_mode_burn 3
|
||||
#define blender_mode_color 4
|
||||
#define blender_mode_difference 5
|
||||
#define blender_mode_dissolve 6
|
||||
#define blender_mode_dodge 7
|
||||
#define blender_mode_hue 8
|
||||
#define blender_mode_invert 9
|
||||
#define blender_mode_luminance 10
|
||||
#define blender_mode_multiply 11
|
||||
#define blender_mode_saturation 12
|
||||
#define blender_mode_screen 13
|
||||
#define blender_mode_alpha 14
|
||||
|
||||
|
||||
#define SCREEN_W (gfx_driver ? gfx_driver->w : 0)
|
||||
#define SCREEN_H (gfx_driver ? gfx_driver->h : 0)
|
||||
|
||||
#define VIRTUAL_W (screen ? screen->w : 0)
|
||||
#define VIRTUAL_H (screen ? screen->h : 0)
|
||||
|
||||
#define COLORCONV_NONE 0
|
||||
|
||||
#define COLORCONV_8_TO_15 1
|
||||
#define COLORCONV_8_TO_16 2
|
||||
#define COLORCONV_8_TO_24 4
|
||||
#define COLORCONV_8_TO_32 8
|
||||
|
||||
#define COLORCONV_15_TO_8 0x10
|
||||
#define COLORCONV_15_TO_16 0x20
|
||||
#define COLORCONV_15_TO_24 0x40
|
||||
#define COLORCONV_15_TO_32 0x80
|
||||
|
||||
#define COLORCONV_16_TO_8 0x100
|
||||
#define COLORCONV_16_TO_15 0x200
|
||||
#define COLORCONV_16_TO_24 0x400
|
||||
#define COLORCONV_16_TO_32 0x800
|
||||
|
||||
#define COLORCONV_24_TO_8 0x1000
|
||||
#define COLORCONV_24_TO_15 0x2000
|
||||
#define COLORCONV_24_TO_16 0x4000
|
||||
#define COLORCONV_24_TO_32 0x8000
|
||||
|
||||
#define COLORCONV_32_TO_8 0x10000
|
||||
#define COLORCONV_32_TO_15 0x20000
|
||||
#define COLORCONV_32_TO_16 0x40000
|
||||
#define COLORCONV_32_TO_24 0x80000
|
||||
|
||||
#define COLORCONV_32A_TO_8 0x100000
|
||||
#define COLORCONV_32A_TO_15 0x200000
|
||||
#define COLORCONV_32A_TO_16 0x400000
|
||||
#define COLORCONV_32A_TO_24 0x800000
|
||||
|
||||
#define COLORCONV_DITHER_PAL 0x1000000
|
||||
#define COLORCONV_DITHER_HI 0x2000000
|
||||
#define COLORCONV_KEEP_TRANS 0x4000000
|
||||
|
||||
#define COLORCONV_DITHER (COLORCONV_DITHER_PAL | \
|
||||
COLORCONV_DITHER_HI)
|
||||
|
||||
#define COLORCONV_EXPAND_256 (COLORCONV_8_TO_15 | \
|
||||
COLORCONV_8_TO_16 | \
|
||||
COLORCONV_8_TO_24 | \
|
||||
COLORCONV_8_TO_32)
|
||||
|
||||
#define COLORCONV_REDUCE_TO_256 (COLORCONV_15_TO_8 | \
|
||||
COLORCONV_16_TO_8 | \
|
||||
COLORCONV_24_TO_8 | \
|
||||
COLORCONV_32_TO_8 | \
|
||||
COLORCONV_32A_TO_8)
|
||||
|
||||
#define COLORCONV_EXPAND_15_TO_16 COLORCONV_15_TO_16
|
||||
|
||||
#define COLORCONV_REDUCE_16_TO_15 COLORCONV_16_TO_15
|
||||
|
||||
#define COLORCONV_EXPAND_HI_TO_TRUE (COLORCONV_15_TO_24 | \
|
||||
COLORCONV_15_TO_32 | \
|
||||
COLORCONV_16_TO_24 | \
|
||||
COLORCONV_16_TO_32)
|
||||
|
||||
#define COLORCONV_REDUCE_TRUE_TO_HI (COLORCONV_24_TO_15 | \
|
||||
COLORCONV_24_TO_16 | \
|
||||
COLORCONV_32_TO_15 | \
|
||||
COLORCONV_32_TO_16)
|
||||
|
||||
#define COLORCONV_24_EQUALS_32 (COLORCONV_24_TO_32 | \
|
||||
COLORCONV_32_TO_24)
|
||||
|
||||
#define COLORCONV_TOTAL (COLORCONV_EXPAND_256 | \
|
||||
COLORCONV_REDUCE_TO_256 | \
|
||||
COLORCONV_EXPAND_15_TO_16 | \
|
||||
COLORCONV_REDUCE_16_TO_15 | \
|
||||
COLORCONV_EXPAND_HI_TO_TRUE | \
|
||||
COLORCONV_REDUCE_TRUE_TO_HI | \
|
||||
COLORCONV_24_EQUALS_32 | \
|
||||
COLORCONV_32A_TO_15 | \
|
||||
COLORCONV_32A_TO_16 | \
|
||||
COLORCONV_32A_TO_24)
|
||||
|
||||
#define COLORCONV_PARTIAL (COLORCONV_EXPAND_15_TO_16 | \
|
||||
COLORCONV_REDUCE_16_TO_15 | \
|
||||
COLORCONV_24_EQUALS_32)
|
||||
|
||||
#define COLORCONV_MOST (COLORCONV_EXPAND_15_TO_16 | \
|
||||
COLORCONV_REDUCE_16_TO_15 | \
|
||||
COLORCONV_EXPAND_HI_TO_TRUE | \
|
||||
COLORCONV_REDUCE_TRUE_TO_HI | \
|
||||
COLORCONV_24_EQUALS_32)
|
||||
|
||||
#define COLORCONV_KEEP_ALPHA (COLORCONV_TOTAL \
|
||||
& ~(COLORCONV_32A_TO_8 | \
|
||||
COLORCONV_32A_TO_15 | \
|
||||
COLORCONV_32A_TO_16 | \
|
||||
COLORCONV_32A_TO_24))
|
||||
|
||||
class BITMAP : public Graphics::ManagedSurface {
|
||||
};
|
||||
|
||||
AL_FUNC(void, set_color_conversion, (int mode));
|
||||
AL_FUNC(int, get_color_conversion, ());
|
||||
AL_FUNC(int, set_gfx_mode, (int card, int w, int h, int v_w, int v_h));
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
39
engines/ags/stubs/allegro/keyboard.cpp
Normal file
39
engines/ags/stubs/allegro/keyboard.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/keyboard.h"
|
||||
#include "common/algorithm.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
bool key[Common::KEYCODE_LAST];
|
||||
|
||||
int install_keyboard() {
|
||||
Common::fill(&key[0], &key[Common::KEYCODE_LAST], false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void remove_keyboard() {
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
105
engines/ags/stubs/allegro/keyboard.h
Normal file
105
engines/ags/stubs/allegro/keyboard.h
Normal file
@ -0,0 +1,105 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_KEYBOARD_H
|
||||
#define AGS_STUBS_ALLEGRO_KEYBOARD_H
|
||||
|
||||
#include "common/keyboard.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
#define KB_SHIFT_FLAG Common::KBD_SHIFT
|
||||
#define KB_CTRL_FLAG Common::KBD_CTRL
|
||||
#define KB_ALT_FLAG Common::KBD_ALT
|
||||
|
||||
#define KEY_F9 Common::KEYCODE_F9
|
||||
#define KEY_LCONTROL Common::KEYCODE_LCTRL
|
||||
#define KEY_RCONTROL Common::KEYCODE_RCTRL
|
||||
|
||||
#define __allegro_KEY_LSHIFT Common::KEYCODE_LSHIFT
|
||||
#define __allegro_KEY_RSHIFT Common::KEYCODE_RSHIFT
|
||||
#define __allegro_KEY_LCONTROL Common::KEYCODE_LCTRL
|
||||
#define __allegro_KEY_RCONTROL Common::KEYCODE_RCTRL
|
||||
#define __allegro_KEY_ALT Common::KEYCODE_LALT
|
||||
|
||||
#define __allegro_KEY_F1 Common::KEYCODE_F1
|
||||
#define __allegro_KEY_F2 Common::KEYCODE_F2
|
||||
#define __allegro_KEY_F3 Common::KEYCODE_F3
|
||||
#define __allegro_KEY_F4 Common::KEYCODE_F4
|
||||
#define __allegro_KEY_F5 Common::KEYCODE_F5
|
||||
#define __allegro_KEY_F6 Common::KEYCODE_F6
|
||||
#define __allegro_KEY_F7 Common::KEYCODE_F7
|
||||
#define __allegro_KEY_F8 Common::KEYCODE_F8
|
||||
#define __allegro_KEY_F9 Common::KEYCODE_F9
|
||||
#define __allegro_KEY_F10 Common::KEYCODE_F10
|
||||
#define __allegro_KEY_F11 Common::KEYCODE_F11
|
||||
#define __allegro_KEY_F12 Common::KEYCODE_F12
|
||||
|
||||
#define __allegro_KEY_HOME Common::KEYCODE_HOME
|
||||
#define __allegro_KEY_UP Common::KEYCODE_UP
|
||||
#define __allegro_KEY_PGUP Common::KEYCODE_PAGEUP
|
||||
#define __allegro_KEY_LEFT Common::KEYCODE_LEFT
|
||||
#define __allegro_KEY_RIGHT Common::KEYCODE_RIGHT
|
||||
#define __allegro_KEY_END Common::KEYCODE_END
|
||||
#define __allegro_KEY_DOWN Common::KEYCODE_DOWN
|
||||
#define __allegro_KEY_PGDN Common::KEYCODE_PAGEDOWN
|
||||
#define __allegro_KEY_INSERT Common::KEYCODE_INSERT
|
||||
#define __allegro_KEY_DEL Common::KEYCODE_DELETE
|
||||
|
||||
#define __allegro_KEY_0_PAD Common::KEYCODE_KP0
|
||||
#define __allegro_KEY_1_PAD Common::KEYCODE_KP1
|
||||
#define __allegro_KEY_2_PAD Common::KEYCODE_KP2
|
||||
#define __allegro_KEY_3_PAD Common::KEYCODE_KP3
|
||||
#define __allegro_KEY_4_PAD Common::KEYCODE_KP4
|
||||
#define __allegro_KEY_5_PAD Common::KEYCODE_KP5
|
||||
#define __allegro_KEY_6_PAD Common::KEYCODE_KP6
|
||||
#define __allegro_KEY_7_PAD Common::KEYCODE_KP7
|
||||
#define __allegro_KEY_8_PAD Common::KEYCODE_KP8
|
||||
#define __allegro_KEY_9_PAD Common::KEYCODE_KP9
|
||||
#define __allegro_KEY_DEL_PAD Common::KEYCODE_KP_PERIOD
|
||||
|
||||
#define __allegro_KEY_PRTSCR Common::KEYCODE_PRINT
|
||||
#define __allegro_KEY_PAUSE Common::KEYCODE_PAUSE
|
||||
#define __allegro_KEY_ABNT_C1 94
|
||||
#define __allegro_KEY_YEN 95
|
||||
#define __allegro_KEY_KANA 96
|
||||
#define __allegro_KEY_CONVERT 97
|
||||
#define __allegro_KEY_NOCONVERT 98
|
||||
#define __allegro_KEY_CIRCUMFLEX 100
|
||||
#define __allegro_KEY_KANJI 102
|
||||
#define __allegro_KEY_ALTGR 120
|
||||
#define __allegro_KEY_LWIN Common::KEYCODE_LMETA
|
||||
#define __allegro_KEY_RWIN Common::KEYCODE_RMETA
|
||||
#define __allegro_KEY_MENU 123
|
||||
#define __allegro_KEY_SCRLOCK Common::KEYCODE_SCROLLOCK
|
||||
#define __allegro_KEY_NUMLOCK Common::KEYCODE_NUMLOCK
|
||||
#define __allegro_KEY_CAPSLOCK Common::KEYCODE_CAPSLOCK
|
||||
|
||||
|
||||
extern bool key[Common::KEYCODE_LAST];
|
||||
|
||||
extern int install_keyboard();
|
||||
extern void remove_keyboard();
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
46
engines/ags/stubs/allegro/midi.cpp
Normal file
46
engines/ags/stubs/allegro/midi.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/midi.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
MIDI_DRIVER *midi_driver;
|
||||
|
||||
MIDI_DRIVER *midi_input_driver;
|
||||
|
||||
int midi_card;
|
||||
|
||||
int midi_input_card;
|
||||
|
||||
volatile long midi_pos; /* current position in the midi file, in beats */
|
||||
volatile long midi_time; /* current position in the midi file, in seconds */
|
||||
|
||||
long midi_loop_start; /* where to loop back to at EOF */
|
||||
long midi_loop_end; /* loop when we hit this position */
|
||||
|
||||
|
||||
int detect_midi_driver(int driver_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
123
engines/ags/stubs/allegro/midi.h
Normal file
123
engines/ags/stubs/allegro/midi.h
Normal file
@ -0,0 +1,123 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_MIDI_H
|
||||
#define AGS_STUBS_ALLEGRO_MIDI_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "ags/stubs/allegro/base.h"
|
||||
#include "ags/stubs/allegro/alconfig.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
/* Theoretical maximums: */
|
||||
#define MIDI_VOICES 64 /* actual drivers may not be */
|
||||
#define MIDI_TRACKS 32 /* able to handle this many */
|
||||
|
||||
/* a midi file */
|
||||
struct MIDI {
|
||||
int divisions; /* number of ticks per quarter note */
|
||||
struct {
|
||||
unsigned char *data; /* MIDI message stream */
|
||||
int len; /* length of the track data */
|
||||
} track[MIDI_TRACKS];
|
||||
};
|
||||
|
||||
|
||||
#define MIDI_AUTODETECT -1
|
||||
#define MIDI_NONE 0
|
||||
#define MIDI_DIGMID AL_ID('D','I','G','I')
|
||||
|
||||
/* driver for playing midi music */
|
||||
struct MIDI_DRIVER {
|
||||
int id; /* driver ID code */
|
||||
AL_CONST char *name; /* driver name */
|
||||
AL_CONST char *desc; /* description string */
|
||||
AL_CONST char *ascii_name; /* ASCII format name string */
|
||||
int voices; /* available voices */
|
||||
int basevoice; /* voice number offset */
|
||||
int max_voices; /* maximum voices we can support */
|
||||
int def_voices; /* default number of voices to use */
|
||||
int xmin, xmax; /* reserved voice range */
|
||||
|
||||
/* setup routines */
|
||||
AL_METHOD(int, detect, (int input));
|
||||
AL_METHOD(int, init, (int input, int voices));
|
||||
AL_METHOD(void, exit, (int input));
|
||||
AL_METHOD(int, set_mixer_volume, (int volume));
|
||||
AL_METHOD(int, get_mixer_volume, (void));
|
||||
|
||||
/* raw MIDI output to MPU-401, etc. */
|
||||
AL_METHOD(void, raw_midi, (int data));
|
||||
|
||||
/* dynamic patch loading routines */
|
||||
AL_METHOD(int, load_patches, (AL_CONST char *patches, AL_CONST char *drums));
|
||||
AL_METHOD(void, adjust_patches, (AL_CONST char *patches, AL_CONST char *drums));
|
||||
|
||||
/* note control functions */
|
||||
AL_METHOD(void, key_on, (int inst, int note, int bend, int vol, int pan));
|
||||
AL_METHOD(void, key_off, (int voice));
|
||||
AL_METHOD(void, set_volume, (int voice, int vol));
|
||||
AL_METHOD(void, set_pitch, (int voice, int note, int bend));
|
||||
AL_METHOD(void, set_pan, (int voice, int pan));
|
||||
AL_METHOD(void, set_vibrato, (int voice, int amount));
|
||||
};
|
||||
|
||||
|
||||
AL_VAR(MIDI_DRIVER, midi_digmid);
|
||||
|
||||
AL_ARRAY(_DRIVER_INFO, _midi_driver_list);
|
||||
|
||||
|
||||
/* macros for constructing the driver lists */
|
||||
#define BEGIN_MIDI_DRIVER_LIST \
|
||||
_DRIVER_INFO _midi_driver_list[] = \
|
||||
{
|
||||
|
||||
#define END_MIDI_DRIVER_LIST \
|
||||
{ 0, NULL, 0 } \
|
||||
};
|
||||
|
||||
#define MIDI_DRIVER_DIGMID \
|
||||
{ MIDI_DIGMID, &midi_digmid, TRUE },
|
||||
|
||||
|
||||
AL_VAR(MIDI_DRIVER *, midi_driver);
|
||||
|
||||
AL_VAR(MIDI_DRIVER *, midi_input_driver);
|
||||
|
||||
AL_VAR(int, midi_card);
|
||||
|
||||
AL_VAR(int, midi_input_card);
|
||||
|
||||
AL_VAR(volatile long, midi_pos); /* current position in the midi file, in beats */
|
||||
AL_VAR(volatile long, midi_time); /* current position in the midi file, in seconds */
|
||||
|
||||
AL_VAR(long, midi_loop_start); /* where to loop back to at EOF */
|
||||
AL_VAR(long, midi_loop_end); /* loop when we hit this position */
|
||||
|
||||
|
||||
AL_FUNC(int, detect_midi_driver, (int driver_id));
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
116
engines/ags/stubs/allegro/mouse.cpp
Normal file
116
engines/ags/stubs/allegro/mouse.cpp
Normal file
@ -0,0 +1,116 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/mouse.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
MOUSE_DRIVER mousedrv_none;
|
||||
MOUSE_DRIVER *mouse_driver;
|
||||
_DRIVER_INFO _mouse_driver_list[];
|
||||
|
||||
BITMAP *mouse_sprite;
|
||||
int mouse_x_focus;
|
||||
int mouse_y_focus;
|
||||
|
||||
volatile int mouse_x;
|
||||
volatile int mouse_y;
|
||||
volatile int mouse_z;
|
||||
volatile int mouse_w;
|
||||
volatile int mouse_b;
|
||||
volatile int mouse_pos;
|
||||
|
||||
volatile int freeze_mouse_flag;
|
||||
|
||||
int install_mouse() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void remove_mouse() {
|
||||
}
|
||||
|
||||
int poll_mouse() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_needs_poll() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void enable_hardware_cursor() {
|
||||
}
|
||||
|
||||
void disable_hardware_cursor() {
|
||||
}
|
||||
|
||||
void show_mouse(BITMAP *bmp) {
|
||||
}
|
||||
|
||||
void scare_mouse() {
|
||||
}
|
||||
|
||||
void scare_mouse_area(int x, int y, int w, int h) {
|
||||
}
|
||||
|
||||
void unscare_mouse() {
|
||||
}
|
||||
|
||||
void position_mouse(int x, int y) {
|
||||
}
|
||||
|
||||
void position_mouse_z(int z) {
|
||||
}
|
||||
|
||||
void position_mouse_w(int w) {
|
||||
}
|
||||
|
||||
void set_mouse_range(int x1, int y_1, int x2, int y2) {
|
||||
}
|
||||
|
||||
void set_mouse_speed(int xspeed, int yspeed) {
|
||||
}
|
||||
|
||||
void select_mouse_cursor(int cursor) {
|
||||
}
|
||||
|
||||
void set_mouse_cursor_bitmap(int cursor, BITMAP *bmp) {
|
||||
}
|
||||
|
||||
void set_mouse_sprite_focus(int x, int y) {
|
||||
}
|
||||
|
||||
void get_mouse_mickeys(int *mickeyx, int *mickeyy) {
|
||||
}
|
||||
|
||||
void set_mouse_sprite(BITMAP *sprite) {
|
||||
}
|
||||
|
||||
int show_os_cursor(int cursor) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mouse_on_screen() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
120
engines/ags/stubs/allegro/mouse.h
Normal file
120
engines/ags/stubs/allegro/mouse.h
Normal file
@ -0,0 +1,120 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_MOUSE_H
|
||||
#define AGS_STUBS_ALLEGRO_MOUSE_H
|
||||
|
||||
#include "common/events.h"
|
||||
#include "ags/stubs/allegro/base.h"
|
||||
#include "ags/stubs/allegro/alconfig.h"
|
||||
#include "ags/stubs/allegro/gfx.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
#define MOUSEDRV_AUTODETECT -1
|
||||
#define MOUSEDRV_NONE 0
|
||||
|
||||
struct MOUSE_DRIVER {
|
||||
int id;
|
||||
AL_CONST char *name;
|
||||
AL_CONST char *desc;
|
||||
AL_CONST char *ascii_name;
|
||||
AL_METHOD(int, init, (void));
|
||||
AL_METHOD(void, exit, (void));
|
||||
AL_METHOD(void, poll, (void));
|
||||
AL_METHOD(void, timer_poll, (void));
|
||||
AL_METHOD(void, position, (int x, int y));
|
||||
AL_METHOD(void, set_range, (int x1, int y_1, int x2, int y2));
|
||||
AL_METHOD(void, set_speed, (int xspeed, int yspeed));
|
||||
AL_METHOD(void, get_mickeys, (int *mickeyx, int *mickeyy));
|
||||
AL_METHOD(int, analyse_data, (AL_CONST char *buffer, int size));
|
||||
AL_METHOD(void, enable_hardware_cursor, (int mode));
|
||||
AL_METHOD(int, select_system_cursor, (int cursor));
|
||||
};
|
||||
|
||||
AL_VAR(MOUSE_DRIVER, mousedrv_none);
|
||||
AL_VAR(MOUSE_DRIVER *, mouse_driver);
|
||||
AL_ARRAY(_DRIVER_INFO, _mouse_driver_list);
|
||||
|
||||
AL_FUNC(int, install_mouse, (void));
|
||||
AL_FUNC(void, remove_mouse, (void));
|
||||
|
||||
AL_FUNC(int, poll_mouse, (void));
|
||||
AL_FUNC(int, mouse_needs_poll, (void));
|
||||
|
||||
AL_FUNC(void, enable_hardware_cursor, (void));
|
||||
AL_FUNC(void, disable_hardware_cursor, (void));
|
||||
|
||||
/* Mouse cursors */
|
||||
#define MOUSE_CURSOR_NONE 0
|
||||
#define MOUSE_CURSOR_ALLEGRO 1
|
||||
#define MOUSE_CURSOR_ARROW 2
|
||||
#define MOUSE_CURSOR_BUSY 3
|
||||
#define MOUSE_CURSOR_QUESTION 4
|
||||
#define MOUSE_CURSOR_EDIT 5
|
||||
#define AL_NUM_MOUSE_CURSORS 6
|
||||
|
||||
AL_VAR(BITMAP *, mouse_sprite);
|
||||
AL_VAR(int, mouse_x_focus);
|
||||
AL_VAR(int, mouse_y_focus);
|
||||
|
||||
AL_VAR(volatile int, mouse_x);
|
||||
AL_VAR(volatile int, mouse_y);
|
||||
AL_VAR(volatile int, mouse_z);
|
||||
AL_VAR(volatile int, mouse_w);
|
||||
AL_VAR(volatile int, mouse_b);
|
||||
AL_VAR(volatile int, mouse_pos);
|
||||
|
||||
AL_VAR(volatile int, freeze_mouse_flag);
|
||||
|
||||
#define MOUSE_FLAG_MOVE 1
|
||||
#define MOUSE_FLAG_LEFT_DOWN 2
|
||||
#define MOUSE_FLAG_LEFT_UP 4
|
||||
#define MOUSE_FLAG_RIGHT_DOWN 8
|
||||
#define MOUSE_FLAG_RIGHT_UP 16
|
||||
#define MOUSE_FLAG_MIDDLE_DOWN 32
|
||||
#define MOUSE_FLAG_MIDDLE_UP 64
|
||||
#define MOUSE_FLAG_MOVE_Z 128
|
||||
#define MOUSE_FLAG_MOVE_W 256
|
||||
|
||||
AL_FUNCPTR(void, mouse_callback, (int flags));
|
||||
|
||||
AL_FUNC(void, show_mouse, (BITMAP *bmp));
|
||||
AL_FUNC(void, scare_mouse, (void));
|
||||
AL_FUNC(void, scare_mouse_area, (int x, int y, int w, int h));
|
||||
AL_FUNC(void, unscare_mouse, (void));
|
||||
AL_FUNC(void, position_mouse, (int x, int y));
|
||||
AL_FUNC(void, position_mouse_z, (int z));
|
||||
AL_FUNC(void, position_mouse_w, (int w));
|
||||
AL_FUNC(void, set_mouse_range, (int x1, int y_1, int x2, int y2));
|
||||
AL_FUNC(void, set_mouse_speed, (int xspeed, int yspeed));
|
||||
AL_FUNC(void, select_mouse_cursor, (int cursor));
|
||||
AL_FUNC(void, set_mouse_cursor_bitmap, (int cursor, BITMAP *bmp));
|
||||
AL_FUNC(void, set_mouse_sprite_focus, (int x, int y));
|
||||
AL_FUNC(void, get_mouse_mickeys, (int *mickeyx, int *mickeyy));
|
||||
AL_FUNC(void, set_mouse_sprite, (BITMAP *sprite));
|
||||
AL_FUNC(int, show_os_cursor, (int cursor));
|
||||
AL_FUNC(int, mouse_on_screen, (void));
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
103
engines/ags/stubs/allegro/sound.cpp
Normal file
103
engines/ags/stubs/allegro/sound.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/sound.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
_DRIVER_INFO _digi_driver_list[] = {
|
||||
{ 0, nullptr, 0 }
|
||||
};
|
||||
|
||||
|
||||
int install_sound(int digi, int midi, const char *cfg_path) {
|
||||
// TODO: install_sound
|
||||
return 0;
|
||||
}
|
||||
|
||||
void remove_sound() {
|
||||
// TODO: remove_sound
|
||||
}
|
||||
|
||||
void reserve_voices(int digi_voices, int midi_voices) {
|
||||
error("reserve_voices");
|
||||
}
|
||||
|
||||
void set_volume_per_voice(int scale) {
|
||||
error("set_volume_per_voice");
|
||||
|
||||
}
|
||||
|
||||
int install_sound_input(int digi, int midi) {
|
||||
error("install_sound_input");
|
||||
}
|
||||
|
||||
void remove_sound_input() {
|
||||
error("remove_sound_input");
|
||||
}
|
||||
|
||||
void set_volume(int digi_volume, int midi_volume) {
|
||||
error("set_volume");
|
||||
}
|
||||
|
||||
void set_hardware_volume(int digi_volume, int midi_volume) {
|
||||
error("set_hardware_volume");
|
||||
}
|
||||
|
||||
void get_volume(int *digi_volume, int *midi_volume) {
|
||||
error("get_volume");
|
||||
}
|
||||
|
||||
void get_hardware_volume(int *digi_volume, int *midi_volume) {
|
||||
error("get_hardware_volume");
|
||||
}
|
||||
|
||||
void set_mixer_quality(int quality) {
|
||||
error("set_mixer_quality");
|
||||
}
|
||||
|
||||
int get_mixer_quality() {
|
||||
error("get_mixer_quality");
|
||||
}
|
||||
|
||||
int get_mixer_frequency() {
|
||||
error("get_mixer_frequency");
|
||||
}
|
||||
|
||||
int get_mixer_bits() {
|
||||
error("get_mixer_bits");
|
||||
}
|
||||
|
||||
int get_mixer_channels() {
|
||||
error("get_mixer_channels");
|
||||
}
|
||||
|
||||
int get_mixer_voices() {
|
||||
error("get_mixer_voices");
|
||||
}
|
||||
|
||||
int get_mixer_buffer_length() {
|
||||
error("get_mixer_buffer_length");
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
57
engines/ags/stubs/allegro/sound.h
Normal file
57
engines/ags/stubs/allegro/sound.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_SOUND_H
|
||||
#define AGS_STUBS_ALLEGRO_SOUND_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "ags/stubs/allegro/base.h"
|
||||
#include "ags/stubs/allegro/alconfig.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
AL_FUNC(void, reserve_voices, (int digi_voices, int midi_voices));
|
||||
AL_FUNC(void, set_volume_per_voice, (int scale));
|
||||
|
||||
AL_FUNC(int, install_sound, (int digi, int midi, AL_CONST char *cfg_path));
|
||||
AL_FUNC(void, remove_sound, (void));
|
||||
|
||||
AL_FUNC(int, install_sound_input, (int digi, int midi));
|
||||
AL_FUNC(void, remove_sound_input, (void));
|
||||
|
||||
AL_FUNC(void, set_volume, (int digi_volume, int midi_volume));
|
||||
AL_FUNC(void, set_hardware_volume, (int digi_volume, int midi_volume));
|
||||
|
||||
AL_FUNC(void, get_volume, (int *digi_volume, int *midi_volume));
|
||||
AL_FUNC(void, get_hardware_volume, (int *digi_volume, int *midi_volume));
|
||||
|
||||
AL_FUNC(void, set_mixer_quality, (int quality));
|
||||
AL_FUNC(int, get_mixer_quality, (void));
|
||||
AL_FUNC(int, get_mixer_frequency, (void));
|
||||
AL_FUNC(int, get_mixer_bits, (void));
|
||||
AL_FUNC(int, get_mixer_channels, (void));
|
||||
AL_FUNC(int, get_mixer_voices, (void));
|
||||
AL_FUNC(int, get_mixer_buffer_length, (void));
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
65
engines/ags/stubs/allegro/system.cpp
Normal file
65
engines/ags/stubs/allegro/system.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/system.h"
|
||||
#include "common/system.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
int color_depth;
|
||||
|
||||
SYSTEM_DRIVER system_none;
|
||||
SYSTEM_DRIVER *system_driver;
|
||||
|
||||
_DRIVER_INFO _system_driver_list[] = {
|
||||
// { SYSTEM_IOS, &system_none, true },
|
||||
{ SYSTEM_NONE, &system_none, false },
|
||||
{ 0, nullptr , 0 }
|
||||
};
|
||||
|
||||
|
||||
void set_color_depth(int depth) {
|
||||
color_depth = depth;
|
||||
}
|
||||
|
||||
int get_color_depth() {
|
||||
return color_depth;
|
||||
}
|
||||
|
||||
int get_desktop_resolution(int *width, int *height) {
|
||||
if (*width)
|
||||
*width = g_system->getWidth();
|
||||
if (*height)
|
||||
*height = g_system->getHeight();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void request_refresh_rate(int rate) {
|
||||
// No implementation
|
||||
}
|
||||
|
||||
void set_close_button_callback(void(*proc)()) {
|
||||
// No implementation
|
||||
}
|
||||
|
||||
} // namespace AGS3
|
103
engines/ags/stubs/allegro/system.h
Normal file
103
engines/ags/stubs/allegro/system.h
Normal file
@ -0,0 +1,103 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_SYSTEM_H
|
||||
#define AGS_STUBS_ALLEGRO_SYSTEM_H
|
||||
|
||||
#include "ags/stubs/allegro/base.h"
|
||||
#include "ags/stubs/allegro/color.h"
|
||||
#include "ags/stubs/allegro/gfx.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
#ifndef AL_METHOD
|
||||
#define AL_METHOD(type, name, args) type (*name) args
|
||||
#endif
|
||||
|
||||
#define SYSTEM_AUTODETECT 0
|
||||
#define SYSTEM_NONE AL_ID('N','O','N','E')
|
||||
|
||||
|
||||
struct GFX_MODE {
|
||||
int width, height, bpp;
|
||||
};
|
||||
|
||||
struct GFX_MODE_LIST {
|
||||
int num_modes; /* number of gfx modes */
|
||||
GFX_MODE *mode; /* pointer to the actual mode list array */
|
||||
};
|
||||
|
||||
struct SYSTEM_DRIVER {
|
||||
int id;
|
||||
char *name;
|
||||
char *desc;
|
||||
char *ascii_name;
|
||||
AL_METHOD(int, init, (void));
|
||||
AL_METHOD(void, exit, (void));
|
||||
AL_METHOD(void, get_executable_name, (char *output, int size));
|
||||
AL_METHOD(int, find_resource, (char *dest, const char *resource, int size));
|
||||
AL_METHOD(void, set_window_title, (const char *name));
|
||||
AL_METHOD(int, set_close_button_callback, (AL_METHOD(void, proc, (void))));
|
||||
AL_METHOD(void, message, (const char *msg));
|
||||
AL_METHOD(void, assert, (const char *msg));
|
||||
AL_METHOD(void, save_console_state, (void));
|
||||
AL_METHOD(void, restore_console_state, (void));
|
||||
AL_METHOD(BITMAP *, create_bitmap, (int color_depth, int width, int height));
|
||||
AL_METHOD(void, created_bitmap, (BITMAP *bmp));
|
||||
AL_METHOD(BITMAP *, create_sub_bitmap, (BITMAP *parent, int x, int y, int width, int height));
|
||||
AL_METHOD(void, created_sub_bitmap, (BITMAP *bmp, BITMAP *parent));
|
||||
AL_METHOD(int, destroy_bitmap, (BITMAP *bitmap));
|
||||
AL_METHOD(void, read_hardware_palette, (void));
|
||||
AL_METHOD(void, set_palette_range, (const RGB *p, int from, int to, int retracesync));
|
||||
AL_METHOD(struct GFX_VTABLE *, get_vtable, (int color_depth));
|
||||
AL_METHOD(int, set_display_switch_mode, (int mode));
|
||||
AL_METHOD(void, display_switch_lock, (int lock, int foreground));
|
||||
AL_METHOD(int, desktop_color_depth, (void));
|
||||
AL_METHOD(int, get_desktop_resolution, (int *width, int *height));
|
||||
AL_METHOD(void, get_gfx_safe_mode, (int *driver, struct GFX_MODE *mode));
|
||||
AL_METHOD(void, yield_timeslice, (void));
|
||||
AL_METHOD(void *, create_mutex, (void));
|
||||
AL_METHOD(void, destroy_mutex, (void *handle));
|
||||
AL_METHOD(void, lock_mutex, (void *handle));
|
||||
AL_METHOD(void, unlock_mutex, (void *handle));
|
||||
AL_METHOD(_DRIVER_INFO *, gfx_drivers, (void));
|
||||
AL_METHOD(_DRIVER_INFO *, digi_drivers, (void));
|
||||
AL_METHOD(_DRIVER_INFO *, midi_drivers, (void));
|
||||
AL_METHOD(_DRIVER_INFO *, keyboard_drivers, (void));
|
||||
AL_METHOD(_DRIVER_INFO *, mouse_drivers, (void));
|
||||
AL_METHOD(_DRIVER_INFO *, joystick_drivers, (void));
|
||||
AL_METHOD(_DRIVER_INFO *, timer_drivers, (void));
|
||||
};
|
||||
|
||||
extern SYSTEM_DRIVER system_none;
|
||||
extern SYSTEM_DRIVER *system_driver;
|
||||
extern _DRIVER_INFO _system_driver_list[];
|
||||
|
||||
extern void set_color_depth(int depth);
|
||||
extern int get_color_depth();
|
||||
extern int get_desktop_resolution(int *width, int *height);
|
||||
extern void request_refresh_rate(int rate);
|
||||
extern void set_close_button_callback(void(*proc)());
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
37
engines/ags/stubs/allegro/unicode.cpp
Normal file
37
engines/ags/stubs/allegro/unicode.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ags/stubs/allegro/unicode.h"
|
||||
#include "common/textconsole.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
void set_uformat(int format) {
|
||||
// TODO: implementation
|
||||
}
|
||||
|
||||
size_t ustrsize(const char *s) {
|
||||
error("TODO: ustrsize");
|
||||
}
|
||||
|
||||
|
||||
} // namespace AGS3
|
41
engines/ags/stubs/allegro/unicode.h
Normal file
41
engines/ags/stubs/allegro/unicode.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AGS_STUBS_ALLEGRO_UNICODE_H
|
||||
#define AGS_STUBS_ALLEGRO_UNICODE_H
|
||||
|
||||
#include "ags/stubs/allegro/base.h"
|
||||
|
||||
namespace AGS3 {
|
||||
|
||||
#define U_ASCII AL_ID('A','S','C','8')
|
||||
#define U_ASCII_CP AL_ID('A','S','C','P')
|
||||
#define U_UNICODE AL_ID('U','N','I','C')
|
||||
#define U_UTF8 AL_ID('U','T','F','8')
|
||||
#define U_CURRENT AL_ID('c','u','r','.')
|
||||
|
||||
extern void set_uformat(int format);
|
||||
extern size_t ustrsize(const char *s);
|
||||
|
||||
} // namespace AGS3
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user