-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add libgambatte sources to the cython extension
- Loading branch information
Showing
88 changed files
with
18,383 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,4 +73,7 @@ parsec/core/gui/rc/generated_misc/ | |
# Temporary files | ||
*~ | ||
*# | ||
ext/*.cpp | ||
ext/*.cpp | ||
|
||
# Build artefacts | ||
*.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
#include "include/gambatte.h" | ||
#include "gambatte.h" | ||
|
||
namespace gambatte { | ||
class GetInput : public InputGetter { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-------------------------------------------------------------------------------- | ||
|
||
Copyright (C) 2007 by sinamas <sinamas at users.sourceforge.net> | ||
|
||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License version 2 as | ||
published by the Free Software Foundation. | ||
|
||
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 version 2 for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
version 2 along with this program; if not, write to the | ||
Free Software Foundation, Inc., | ||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
The source code for the libgambatte library is directly taken from: | ||
- [sinamas/gambatte 56e3371 ./libgambatte](https://github.com/sinamas/gambatte/tree/56e3371151b5ee86dcdcf4868324ebc6de220bc9/libgambatte) | ||
|
||
On top of it, the following commit has been applied: | ||
- [Fix crash for ROMs with RTC (revert logic in MemPtrs::setRambank)](https://github.com/sinamas/gambatte/pull/18/commits/cfddac6ecc28136457d44f4f80ee8fb5d0f34f5d) by [entrpntr](https://github.com/entrpntr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*************************************************************************** | ||
* Copyright (C) 2008 by Sindre Aamås * | ||
* [email protected] * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License version 2 as * | ||
* published by the Free Software Foundation. * | ||
* * | ||
* 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 version 2 for more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License * | ||
* version 2 along with this program; if not, write to the * | ||
* Free Software Foundation, Inc., * | ||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
***************************************************************************/ | ||
#ifndef ARRAY_H | ||
#define ARRAY_H | ||
|
||
#include "defined_ptr.h" | ||
#include "uncopyable.h" | ||
#include <cstddef> | ||
|
||
template<typename T> | ||
class SimpleArray : Uncopyable { | ||
public: | ||
explicit SimpleArray(std::size_t size = 0) : a_(size ? new T[size] : 0) {} | ||
~SimpleArray() { delete[] defined_ptr(a_); } | ||
void reset(std::size_t size = 0) { delete[] defined_ptr(a_); a_ = size ? new T[size] : 0; } | ||
T * get() const { return a_; } | ||
operator T *() const { return a_; } | ||
|
||
private: | ||
T *a_; | ||
}; | ||
|
||
template<typename T> | ||
class Array { | ||
public: | ||
explicit Array(std::size_t size = 0) : a_(size), size_(size) {} | ||
void reset(std::size_t size = 0) { a_.reset(size); size_ = size; } | ||
std::size_t size() const { return size_; } | ||
T * get() const { return a_; } | ||
operator T *() const { return a_; } | ||
|
||
private: | ||
SimpleArray<T> a_; | ||
std::size_t size_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef DEFINED_PTR_H | ||
#define DEFINED_PTR_H | ||
|
||
template<class T> | ||
inline T * defined_ptr(T *t) { | ||
typedef char type_is_defined[sizeof *t ? 1 : -1]; | ||
(void) sizeof(type_is_defined); | ||
return t; | ||
} | ||
|
||
template<class T> | ||
inline void defined_delete(T *t) { delete defined_ptr(t); } | ||
|
||
struct defined_deleter { template<class T> static void del(T *p) { defined_delete(p); } }; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef SCOPED_PTR_H | ||
#define SCOPED_PTR_H | ||
|
||
#include "transfer_ptr.h" | ||
#include "uncopyable.h" | ||
|
||
template<class T, class Deleter = defined_deleter> | ||
class scoped_ptr : Uncopyable { | ||
public: | ||
explicit scoped_ptr(T *p = 0) : p_(p) {} | ||
template<class U> explicit scoped_ptr(transfer_ptr<U, Deleter> p) : p_(p.release()) {} | ||
~scoped_ptr() { Deleter::del(p_); } | ||
T * get() const { return p_; } | ||
void reset(T *p = 0) { Deleter::del(p_); p_ = p; } | ||
T & operator*() const { return *p_; } | ||
T * operator->() const { return p_; } | ||
operator bool() const { return p_; } | ||
|
||
template<class U> | ||
scoped_ptr & operator=(transfer_ptr<U, Deleter> p) { | ||
reset(p.release()); | ||
return *this; | ||
} | ||
|
||
private: | ||
T *p_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef TRANSFER_PTR_H | ||
#define TRANSFER_PTR_H | ||
|
||
#include "defined_ptr.h" | ||
|
||
template<class T, class Deleter = defined_deleter> | ||
class transfer_ptr { | ||
private: | ||
struct released { T *p; explicit released(T *p) : p(p) {} }; | ||
public: | ||
explicit transfer_ptr(T *p = 0) : p_(p) {} | ||
transfer_ptr(transfer_ptr &p) : p_(p.release()) {} | ||
transfer_ptr(released r) : p_(r.p) {} | ||
~transfer_ptr() { Deleter::del(p_); } | ||
T * get() const { return p_; } | ||
T * release() { T *p = p_; p_ = 0; return p; } | ||
operator released const () { return released(release()); } | ||
T & operator*() const { return *p_; } | ||
T * operator->() const { return p_; } | ||
operator bool() const { return p_; } | ||
|
||
private: | ||
T *p_; | ||
transfer_ptr & operator=(transfer_ptr const &); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*************************************************************************** | ||
* Copyright (C) 2009 by Sindre Aamås * | ||
* [email protected] * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License version 2 as * | ||
* published by the Free Software Foundation. * | ||
* * | ||
* 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 version 2 for more details. * | ||
* * | ||
* You should have received a copy of the GNU General Public License * | ||
* version 2 along with this program; if not, write to the * | ||
* Free Software Foundation, Inc., * | ||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
***************************************************************************/ | ||
#ifndef UNCOPYABLE_H | ||
#define UNCOPYABLE_H | ||
|
||
class Uncopyable { | ||
protected: | ||
Uncopyable() {} | ||
private: | ||
Uncopyable(Uncopyable const &); | ||
Uncopyable& operator=(Uncopyable const &); | ||
}; | ||
|
||
#endif |
Binary file not shown.
Oops, something went wrong.