Merged revisions 32124,32126-32128,32131,32133,32135-32144,32146-32153,32155-32163,32165-32168,32170-32173,32175-32179,32181-32191,32193-32202,32204-32205,32209-32214,32216,32218,32220-32235,32237-32266,32269-32271,32273-32290,32292-32295,32297-32317,32319-32323,32325-32328,32330-32331,32334-32338,32343-32347 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk svn-id: r32350
This commit is contained in:
commit
8297ead267
302 changed files with 9179 additions and 18879 deletions
1
NEWS
1
NEWS
|
@ -6,6 +6,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
- Added support for The Legend of Kyrandia: Book Two: Hand of Fate
|
- Added support for The Legend of Kyrandia: Book Two: Hand of Fate
|
||||||
- Added support for The Legend of Kyrandia: Book Three: Malcolm's Revenge
|
- Added support for The Legend of Kyrandia: Book Three: Malcolm's Revenge
|
||||||
- Added support for Lost in Time
|
- Added support for Lost in Time
|
||||||
|
- Added support for The Bizarre Adventures of Woodruff and the Schnibble
|
||||||
- Added support for the PC version of Waxworks
|
- Added support for the PC version of Waxworks
|
||||||
- Added support for the Macintosh version of I Have no Mouth, and I
|
- Added support for the Macintosh version of I Have no Mouth, and I
|
||||||
must Scream
|
must Scream
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(__GP32__)
|
|
||||||
#include "backends/fs/gp32/gp32-fs-factory.h"
|
|
||||||
#include "backends/fs/gp32/gp32-fs.cpp"
|
|
||||||
|
|
||||||
DECLARE_SINGLETON(GP32FilesystemFactory);
|
|
||||||
|
|
||||||
AbstractFilesystemNode *GP32FilesystemFactory::makeRootFileNode() const {
|
|
||||||
return new GP32FilesystemNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractFilesystemNode *GP32FilesystemFactory::makeCurrentDirectoryFileNode() const {
|
|
||||||
return new GP32FilesystemNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractFilesystemNode *GP32FilesystemFactory::makeFileNodePath(const String &path) const {
|
|
||||||
return new GP32FilesystemNode(path);
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,51 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GP32_FILESYSTEM_FACTORY_H
|
|
||||||
#define GP32_FILESYSTEM_FACTORY_H
|
|
||||||
|
|
||||||
#include "common/singleton.h"
|
|
||||||
#include "backends/fs/fs-factory.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates GP32FilesystemNode objects.
|
|
||||||
*
|
|
||||||
* Parts of this class are documented in the base interface class, FilesystemFactory.
|
|
||||||
*/
|
|
||||||
class GP32FilesystemFactory : public FilesystemFactory, public Common::Singleton<GP32FilesystemFactory> {
|
|
||||||
public:
|
|
||||||
typedef Common::String String;
|
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
GP32FilesystemFactory() {};
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /*GP32_FILESYSTEM_FACTORY_H*/
|
|
|
@ -1,256 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "backends/fs/abstract-fs.h"
|
|
||||||
|
|
||||||
#define MAX_PATH_SIZE 256
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of the ScummVM file system API.
|
|
||||||
*
|
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
|
||||||
*/
|
|
||||||
class GP32FilesystemNode : public AbstractFilesystemNode {
|
|
||||||
protected:
|
|
||||||
String _displayName;
|
|
||||||
String _path;
|
|
||||||
bool _isDirectory;
|
|
||||||
bool _isRoot;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* Creates a GP32FilesystemNode with the root node as path.
|
|
||||||
*/
|
|
||||||
GP32FilesystemNode();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a GP32FilesystemNode for a given path.
|
|
||||||
*
|
|
||||||
* @param path String with the path the new node should point to.
|
|
||||||
*/
|
|
||||||
GP32FilesystemNode(const String &path);
|
|
||||||
|
|
||||||
virtual bool exists() const { return true; } //FIXME: this is just a stub
|
|
||||||
virtual String getDisplayName() const { return _displayName; }
|
|
||||||
virtual String getName() const { return _displayName; }
|
|
||||||
virtual String getPath() const { return _path; }
|
|
||||||
virtual bool isDirectory() const { return _isDirectory; }
|
|
||||||
// FIXME: isValid should return false if this Node can't be used!
|
|
||||||
// so client code can rely on the return value.
|
|
||||||
virtual bool isReadable() const { return true; } //FIXME: this is just a stub
|
|
||||||
virtual bool isWritable() const { return true; } //FIXME: this is just a stub
|
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *getChild(const String &n) const;
|
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
|
||||||
virtual AbstractFilesystemNode *getParent() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
const char gpRootPath[] = "gp:\\";
|
|
||||||
//char gpCurrentPath[MAX_PATH_SIZE] = "gp:\\"; // must end with '\'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the last component of a given path.
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* gp:\foo\bar.txt would return "\bar.txt"
|
|
||||||
* gp:\foo\bar\ would return "\bar\"
|
|
||||||
*
|
|
||||||
* @param str Path to obtain the last component from.
|
|
||||||
* @return Pointer to the first char of the last component inside str.
|
|
||||||
*/
|
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
|
||||||
if(str.empty())
|
|
||||||
return "";
|
|
||||||
|
|
||||||
const char *start = str.c_str();
|
|
||||||
const char *cur = start + str.size() - 2;
|
|
||||||
|
|
||||||
while (cur >= start && *cur != '\\') {
|
|
||||||
--cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cur + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME: document this function.
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
* @param convPath
|
|
||||||
*/
|
|
||||||
int gpMakePath(const char *path, char *convPath) {
|
|
||||||
// copy root or current directory
|
|
||||||
const char *p;
|
|
||||||
if ((*path == '/') || (*path == '\\')) {
|
|
||||||
path++;
|
|
||||||
p = gpRootPath;
|
|
||||||
while (*p)
|
|
||||||
*convPath++ = *p++;
|
|
||||||
}// else
|
|
||||||
// p = gpCurrentPath;
|
|
||||||
|
|
||||||
//while (*p)
|
|
||||||
// *convPath++ = *p++;
|
|
||||||
|
|
||||||
// add filenames/directories. remove "." & "..", replace "/" with "\"
|
|
||||||
do {
|
|
||||||
switch (*path) {
|
|
||||||
case 0:
|
|
||||||
case '/':
|
|
||||||
case '\\':
|
|
||||||
if (*(convPath - 1) == '\\') {
|
|
||||||
// already ends with '\'
|
|
||||||
} else if ((*(convPath - 2) == '\\') && (*(convPath - 1) == '.')) {
|
|
||||||
convPath--; // remove '.' and end with '\'
|
|
||||||
} else if ((*(convPath - 3) == '\\') && (*(convPath - 2) == '.') && (*(convPath - 1) == '.')) {
|
|
||||||
convPath -= 3; // remove "\.."
|
|
||||||
if (*(convPath - 1) == ':')
|
|
||||||
*convPath++ = '\\'; // "gp:" -> "gp:\"
|
|
||||||
else
|
|
||||||
while (*(convPath - 1) != '\\')
|
|
||||||
convPath--; // remove one directory and end with '\'
|
|
||||||
} else {
|
|
||||||
*convPath++ = '\\'; // just add '\'
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
*convPath++ = *path;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (*path++);
|
|
||||||
|
|
||||||
*convPath = '\\';
|
|
||||||
|
|
||||||
// *--convPath = 0; // remove last '\' and null-terminate
|
|
||||||
*convPath = 0; // remove last '\' and null-terminate
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
GP32FilesystemNode::GP32FilesystemNode() {
|
|
||||||
_isDirectory = true;
|
|
||||||
_isRoot = true;
|
|
||||||
_displayName = "GP32 Root";
|
|
||||||
_path = "gp:\\";
|
|
||||||
}
|
|
||||||
|
|
||||||
GP32FilesystemNode::GP32FilesystemNode(const String &path) {
|
|
||||||
const char *dsplName = NULL, *pos = NULL;
|
|
||||||
char convPath[256];
|
|
||||||
|
|
||||||
gpMakePath(path.c_str(), convPath);
|
|
||||||
|
|
||||||
_path = convPath;
|
|
||||||
pos = convPath;
|
|
||||||
|
|
||||||
while (*pos)
|
|
||||||
if (*pos++ == '\\')
|
|
||||||
dsplName = pos;
|
|
||||||
|
|
||||||
BP("FS: path name: %s", path.c_str());
|
|
||||||
|
|
||||||
if (strcmp(path.c_str(), "gp:\\") == 0) {
|
|
||||||
_isRoot = true;
|
|
||||||
_displayName = "GP32 Root";
|
|
||||||
} else {
|
|
||||||
_isRoot = false;
|
|
||||||
_displayName = String(dsplName);
|
|
||||||
}
|
|
||||||
_isDirectory = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractFilesystemNode *GP32FilesystemNode::getChild(const String &n) const {
|
|
||||||
// FIXME: Pretty lame implementation! We do no error checking to speak
|
|
||||||
// of, do not check if this is a special node, etc.
|
|
||||||
assert(_isDirectory);
|
|
||||||
|
|
||||||
String newPath(_path);
|
|
||||||
if (_path.lastChar() != '\\')
|
|
||||||
newPath += '\\';
|
|
||||||
newPath += n;
|
|
||||||
|
|
||||||
return new GP32FilesystemNode(newPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GP32FilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
|
|
||||||
assert(_isDirectory);
|
|
||||||
|
|
||||||
//TODO: honor the hidden flag
|
|
||||||
|
|
||||||
GPDIRENTRY dirEntry;
|
|
||||||
GPFILEATTR attr;
|
|
||||||
GP32FilesystemNode entry;
|
|
||||||
uint32 read;
|
|
||||||
|
|
||||||
if (mode == FilesystemNode::kListAll)
|
|
||||||
LP("listDir(kListAll)");
|
|
||||||
else
|
|
||||||
LP("listDir(kListDirectoriesOnly)");
|
|
||||||
|
|
||||||
int startIdx = 0; // current file
|
|
||||||
String listDir(_path);
|
|
||||||
//listDir += "/";
|
|
||||||
|
|
||||||
while (GpDirEnumList(listDir.c_str(), startIdx++, 1, &dirEntry, &read) == SM_OK) {
|
|
||||||
da if (dirEntry.name[0] == '.')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
entry._displayName = dirEntry.name;
|
|
||||||
entry._path = _path;
|
|
||||||
entry._path += dirEntry.name;
|
|
||||||
entry._isRoot = false;
|
|
||||||
|
|
||||||
GpFileAttr(entry._path.c_str(), &attr);
|
|
||||||
entry._isDirectory = attr.attr & (1 << 4);
|
|
||||||
|
|
||||||
// Honor the chosen mode
|
|
||||||
if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) ||
|
|
||||||
(mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (entry._isDirectory)
|
|
||||||
entry._path += "\\";
|
|
||||||
myList.push_back(new GP32FilesystemNode(entry));
|
|
||||||
}
|
|
||||||
|
|
||||||
BP("Dir... %s", listDir.c_str());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractFilesystemNode *GP32FilesystemNode::getParent() const {
|
|
||||||
if (_isRoot)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
const char *start = _path.c_str();
|
|
||||||
const char *end = lastPathComponent(_path);
|
|
||||||
|
|
||||||
GP32FilesystemNode *p = new GP32FilesystemNode(String(start, end - start));
|
|
||||||
|
|
||||||
NP("%s", p->_path.c_str());
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
|
@ -24,6 +24,17 @@
|
||||||
|
|
||||||
#ifdef MACOSX
|
#ifdef MACOSX
|
||||||
|
|
||||||
|
// HACK to disable deprecated warnings under Mac OS X 10.5.
|
||||||
|
// Apple depracted the AUGraphNewNode & AUGraphGetNodeInfo APIs
|
||||||
|
// in favor of the new AUGraphAddNode & AUGraphNodeInfo APIs.
|
||||||
|
// While it would be trivial to switch to those, this would break
|
||||||
|
// binary compatibility with all pre-10.5 systems, so we don't want
|
||||||
|
// to do that just now. Maybe when 10.6 comes... :)
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#undef DEPRECATED_ATTRIBUTE
|
||||||
|
#define DEPRECATED_ATTRIBUTE
|
||||||
|
|
||||||
|
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "sound/midiplugin.h"
|
#include "sound/midiplugin.h"
|
||||||
|
|
|
@ -24,6 +24,18 @@
|
||||||
|
|
||||||
#if defined(MACOSX) || defined(macintosh)
|
#if defined(MACOSX) || defined(macintosh)
|
||||||
|
|
||||||
|
// HACK to disable deprecated warnings under Mac OS X 10.5.
|
||||||
|
// Apple depracted the complete QuickTime Music/MIDI API.
|
||||||
|
// Apps are supposed to use CoreAudio & CoreMIDI. We do support
|
||||||
|
// those, but while QT Midi support is still around, there is no
|
||||||
|
// reason to disable this driver. If they really ditch the API in 10.6,
|
||||||
|
// we can still release binaries with this driver disabled/removed.
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#undef DEPRECATED_ATTRIBUTE
|
||||||
|
#define DEPRECATED_ATTRIBUTE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "common/endian.h"
|
#include "common/endian.h"
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "sound/midiplugin.h"
|
#include "sound/midiplugin.h"
|
||||||
|
@ -285,10 +297,10 @@ MidiDriver *MidiDriver_QT_create(Audio::Mixer *mixer) {
|
||||||
return mididriver;
|
return mididriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#if PLUGIN_ENABLED_DYNAMIC(QT)
|
//#if PLUGIN_ENABLED_DYNAMIC(QUICKTIME)
|
||||||
//REGISTER_PLUGIN_DYNAMIC(QT, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
|
//REGISTER_PLUGIN_DYNAMIC(QUICKTIME, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
|
||||||
//#else
|
//#else
|
||||||
REGISTER_PLUGIN_STATIC(QT, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
|
REGISTER_PLUGIN_STATIC(QUICKTIME, PLUGIN_TYPE_MIDI, QuickTimeMidiPlugin);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#endif // MACOSX || macintosh
|
#endif // MACOSX || macintosh
|
||||||
|
|
|
@ -3,7 +3,6 @@ MODULE := backends
|
||||||
MODULE_OBJS := \
|
MODULE_OBJS := \
|
||||||
fs/amigaos4/amigaos4-fs-factory.o \
|
fs/amigaos4/amigaos4-fs-factory.o \
|
||||||
fs/ds/ds-fs-factory.o \
|
fs/ds/ds-fs-factory.o \
|
||||||
fs/gp32/gp32-fs-factory.o \
|
|
||||||
fs/palmos/palmos-fs-factory.o \
|
fs/palmos/palmos-fs-factory.o \
|
||||||
fs/posix/posix-fs-factory.o \
|
fs/posix/posix-fs-factory.o \
|
||||||
fs/ps2/ps2-fs-factory.o \
|
fs/ps2/ps2-fs-factory.o \
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "be_base.h"
|
#include "be_base.h"
|
||||||
#include "be_save.h"
|
|
||||||
#include "common/config-file.h"
|
#include "common/config-file.h"
|
||||||
#include "common/config-manager.h"
|
#include "common/config-manager.h"
|
||||||
|
#include "backends/saves/default/default-saves.h"
|
||||||
#include "backends/timer/default/default-timer.h"
|
#include "backends/timer/default/default-timer.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ void OSystem_PalmBase::initBackend() {
|
||||||
// Create the savefile manager, if none exists yet (we check for this to
|
// Create the savefile manager, if none exists yet (we check for this to
|
||||||
// allow subclasses to provide their own).
|
// allow subclasses to provide their own).
|
||||||
if (_saveMgr == 0) {
|
if (_saveMgr == 0) {
|
||||||
_saveMgr = new PalmSaveFileManager();
|
_saveMgr = new DefaultSaveFileManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create and hook up the mixer, if none exists yet (we check for this to
|
// Create and hook up the mixer, if none exists yet (we check for this to
|
||||||
|
@ -120,6 +120,11 @@ void OSystem_PalmBase::initBackend() {
|
||||||
OSystem::initBackend();
|
OSystem::initBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OSystem_PalmBase::getTimeAndDate(struct tm &t) const {
|
||||||
|
time_t curTime = time(0);
|
||||||
|
t = *localtime(&curTime);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 OSystem_PalmBase::getMillis() {
|
uint32 OSystem_PalmBase::getMillis() {
|
||||||
return TimGetTicks() * 1000 / SysTicksPerSecond();
|
return TimGetTicks() * 1000 / SysTicksPerSecond();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#ifndef BE_BASE_H
|
#ifndef BE_BASE_H
|
||||||
#define BE_BASE_H
|
#define BE_BASE_H
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "PalmVersion.h"
|
#include "PalmVersion.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
|
@ -236,6 +238,7 @@ public:
|
||||||
|
|
||||||
bool pollEvent(Common::Event &event);
|
bool pollEvent(Common::Event &event);
|
||||||
|
|
||||||
|
void getTimeAndDate(struct tm &t) const;
|
||||||
virtual uint32 getMillis();
|
virtual uint32 getMillis();
|
||||||
virtual void delayMillis(uint msecs);
|
virtual void delayMillis(uint msecs);
|
||||||
|
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "be_base.h"
|
|
||||||
#include "common/savefile.h"
|
|
||||||
#include "be_save.h"
|
|
||||||
|
|
||||||
Common::StringList PalmSaveFileManager::listSavefiles(const char *pattern) {
|
|
||||||
TODO: Implement this. If you don't understand what it should do, just ask
|
|
||||||
(e.g. on scummvm-devel or Fingolfin). It should be pretty simple if you
|
|
||||||
use Common::matchString from common/util.h and read the Doxygen docs,
|
|
||||||
then combine this with the old code below...
|
|
||||||
|
|
||||||
/*
|
|
||||||
void PalmSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) {
|
|
||||||
FileRef fileRef;
|
|
||||||
// try to open the dir
|
|
||||||
Err e = VFSFileOpen(gVars->VFS.volRefNum, SCUMMVM_SAVEPATH, vfsModeRead, &fileRef);
|
|
||||||
memset(marks, false, num*sizeof(bool));
|
|
||||||
|
|
||||||
if (e != errNone)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// enumerate all files
|
|
||||||
UInt32 dirEntryIterator = vfsIteratorStart;
|
|
||||||
Char filename[32];
|
|
||||||
FileInfoType info = {0, filename, 32};
|
|
||||||
UInt16 length = StrLen(prefix);
|
|
||||||
int slot = 0;
|
|
||||||
|
|
||||||
while (dirEntryIterator != vfsIteratorStop) {
|
|
||||||
e = VFSDirEntryEnumerate (fileRef, &dirEntryIterator, &info);
|
|
||||||
|
|
||||||
if (e != expErrEnumerationEmpty) { // there is something
|
|
||||||
|
|
||||||
if (StrLen(info.nameP) == (length + 2)) { // consider max 99, filename length is ok
|
|
||||||
if (StrNCaselessCompare(prefix, info.nameP, length) == 0) { // this seems to be a save file
|
|
||||||
if (isdigit(info.nameP[length]) && isdigit(info.nameP[length+1])) {
|
|
||||||
|
|
||||||
slot = StrAToI(filename + length);
|
|
||||||
if (slot >= 0 && slot < num)
|
|
||||||
*(marks+slot) = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
VFSFileClose(fileRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BACKEND_SAVES_PALM_H
|
|
||||||
#define BACKEND_SAVES_PALM_H
|
|
||||||
|
|
||||||
#include "saves/default/default-saves.h"
|
|
||||||
|
|
||||||
class PalmSaveFileManager : public DefaultSaveFileManager {
|
|
||||||
public:
|
|
||||||
Common::StringList listSavefiles(const char *pattern);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -29,8 +29,6 @@
|
||||||
|
|
||||||
#include "modulesrsc.h"
|
#include "modulesrsc.h"
|
||||||
|
|
||||||
const char *SCUMMVM_SAVEPATH = "/PALM/Programs/ScummVM/Saved";
|
|
||||||
|
|
||||||
void PalmFatalError(const char *err) {
|
void PalmFatalError(const char *err) {
|
||||||
WinSetDrawWindow(WinGetDisplayWindow());
|
WinSetDrawWindow(WinGetDisplayWindow());
|
||||||
WinPalette(winPaletteSetToDefault,0,0,0);
|
WinPalette(winPaletteSetToDefault,0,0,0);
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
#define PREFIX_H
|
#define PREFIX_H
|
||||||
|
|
||||||
#include "native_common.h"
|
#include "native_common.h"
|
||||||
#define ENABLE_KYRA
|
#define ENABLE_KYRA STATIC_PLUGIN
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
7
backends/platform/PalmOS/Src/prefixes/native_m4.h
Executable file
7
backends/platform/PalmOS/Src/prefixes/native_m4.h
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef PREFIX_H
|
||||||
|
#define PREFIX_H
|
||||||
|
|
||||||
|
#include "native_common.h"
|
||||||
|
#define ENABLE_M4 STATIC_PLUGIN
|
||||||
|
|
||||||
|
#endif
|
7
backends/platform/PalmOS/Src/prefixes/native_made.h
Executable file
7
backends/platform/PalmOS/Src/prefixes/native_made.h
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef PREFIX_H
|
||||||
|
#define PREFIX_H
|
||||||
|
|
||||||
|
#include "native_common.h"
|
||||||
|
#define ENABLE_MADE STATIC_PLUGIN
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,7 +2,7 @@
|
||||||
#define PREFIX_H
|
#define PREFIX_H
|
||||||
|
|
||||||
#include "native_common.h"
|
#include "native_common.h"
|
||||||
#define ENABLE_SWORD1
|
#define ENABLE_SWORD1 STATIC_PLUGIN
|
||||||
#define USE_MPEG2
|
#define USE_MPEG2
|
||||||
#define USE_VORBIS
|
#define USE_VORBIS
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ ifeq ($(SCUMM_BUILD),g)
|
||||||
DS_BUILD_G = 1
|
DS_BUILD_G = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#DS_BUILD_A = 1
|
DS_BUILD_A = 1
|
||||||
#DS_BUILD_B = 1
|
#DS_BUILD_B = 1
|
||||||
#DS_BUILD_C = 1
|
#DS_BUILD_C = 1
|
||||||
#DS_BUILD_D = 1 # started!
|
#DS_BUILD_D = 1
|
||||||
#DS_BUILD_E = 1
|
#DS_BUILD_E = 1
|
||||||
#DS_BUILD_F = 1
|
#DS_BUILD_F = 1
|
||||||
#DS_BUILD_G = 1
|
#DS_BUILD_G = 1
|
||||||
|
@ -82,11 +82,15 @@ VPATH = $(srcdir)
|
||||||
|
|
||||||
USE_ARM_SOUND_ASM = 1
|
USE_ARM_SOUND_ASM = 1
|
||||||
ARM = 1
|
ARM = 1
|
||||||
|
USE_ARM_COSTUME_ASM = 1
|
||||||
|
|
||||||
ifdef DS_BUILD_A
|
ifdef DS_BUILD_A
|
||||||
DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM
|
DEFINES = -DDS_SCUMM_BUILD -DDS_BUILD_A -DUSE_ARM_GFX_ASM -DUSE_ARM_COSTUME_ASM
|
||||||
LOGO = logoa.bmp
|
LOGO = logoa.bmp
|
||||||
ENABLE_SCUMM = STATIC_PLUGIN
|
ENABLE_SCUMM = STATIC_PLUGIN
|
||||||
|
DEFINES += -DENABLE_SCUMM=STATIC_PLUGIN
|
||||||
|
MODULES += engines/scumm
|
||||||
|
|
||||||
USE_ARM_GFX_ASM = 1
|
USE_ARM_GFX_ASM = 1
|
||||||
BUILD=scummvm-A
|
BUILD=scummvm-A
|
||||||
endif
|
endif
|
||||||
|
@ -146,10 +150,12 @@ CXX = arm-eabi-g++
|
||||||
CFLAGS = -Wno-multichar -Wall\
|
CFLAGS = -Wno-multichar -Wall\
|
||||||
-Wno-multichar -mcpu=arm9tdmi -mtune=arm9tdmi \
|
-Wno-multichar -mcpu=arm9tdmi -mtune=arm9tdmi \
|
||||||
-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
|
-mcpu=arm9tdmi -mtune=arm9tdmi -fomit-frame-pointer\
|
||||||
-ffast-math -mthumb-interwork
|
-mthumb-interwork -DUSE_ARM_COSTUME_ASM=1
|
||||||
|
|
||||||
|
# -ffast-math
|
||||||
|
|
||||||
ifdef USE_DEBUGGER
|
ifdef USE_DEBUGGER
|
||||||
DEFINES += -DUSE_DEBUGGER
|
DEFINES += -DUSE_DEBUGGER
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -258,14 +264,18 @@ OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp fmopl.cpp rate.cpp
|
||||||
#OPTLIST :=
|
#OPTLIST :=
|
||||||
|
|
||||||
# Compiler options for files which should be optimised for speed
|
# Compiler options for files which should be optimised for speed
|
||||||
OPT_SPEED := -O3
|
OPT_SPEED := -O2
|
||||||
|
|
||||||
# Compiler options for files which should be optimised for space
|
# Compiler options for files which should be optimised for space
|
||||||
OPT_SIZE := -Os -mthumb -fno-gcse -fno-schedule-insns2
|
OPT_SIZE := -Os
|
||||||
|
|
||||||
|
|
||||||
|
#-mthumb -fno-gcse -fno-schedule-insns2
|
||||||
|
|
||||||
OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS)
|
|
||||||
|
|
||||||
|
OBJS := $(DATA_OBJS) $(LIBCARTRESET_OBJS) $(PORT_OBJS) $(COMPRESSOR_OBJS) $(FAT_OBJS)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -330,8 +340,8 @@ endef
|
||||||
ifndef HAVE_GCC3
|
ifndef HAVE_GCC3
|
||||||
# If you use GCC, disable the above and enable this for intelligent
|
# If you use GCC, disable the above and enable this for intelligent
|
||||||
# dependency tracking.
|
# dependency tracking.
|
||||||
.cpp.o:
|
#.cpp.o:
|
||||||
|
%.o:%.cpp
|
||||||
$(MKDIR) $(*D)/$(DEPDIR)
|
$(MKDIR) $(*D)/$(DEPDIR)
|
||||||
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d2" $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||||
# $(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
|
# $(ECHO) "$(*D)/" > $(*D)/$(DEPDIR)/$(*F).d
|
||||||
|
@ -342,7 +352,8 @@ else
|
||||||
# rule can get you into a bad state if you Ctrl-C at the wrong moment.
|
# rule can get you into a bad state if you Ctrl-C at the wrong moment.
|
||||||
# Also, with this GCC inserts additional dummy rules for the involved headers,
|
# Also, with this GCC inserts additional dummy rules for the involved headers,
|
||||||
# which ensures a smooth compilation even if said headers become obsolete.
|
# which ensures a smooth compilation even if said headers become obsolete.
|
||||||
.cpp.o:
|
#.cpp.o:
|
||||||
|
%.o:%.cpp
|
||||||
# echo !!!!!!!!!!!! $(notdir $<)
|
# echo !!!!!!!!!!!! $(notdir $<)
|
||||||
# ifeq ( $(notdir $<), $(findstring $(notdir $<), $(OPTLIST)) )
|
# ifeq ( $(notdir $<), $(findstring $(notdir $<), $(OPTLIST)) )
|
||||||
# OPTFLAG=-O3
|
# OPTFLAG=-O3
|
||||||
|
|
|
@ -55,14 +55,14 @@ ARM_adpcm
|
||||||
loop:
|
loop:
|
||||||
LDRH r10,[r11,r2] @ r10 = stepTab[stepTableIndex]
|
LDRH r10,[r11,r2] @ r10 = stepTab[stepTableIndex]
|
||||||
TST r12,#4 @ if ((offset & 4) == 0)
|
TST r12,#4 @ if ((offset & 4) == 0)
|
||||||
MOVEQ r9, #0 @ r9 = diff = 0
|
MOVEQ r9, #0 @ r9 = diff = 0
|
||||||
MOVNE r9, r10 @ else r9 = diff = stepTab[stepTableIndex]
|
MOVNE r9, r10 @ else r9 = diff = stepTab[stepTableIndex]
|
||||||
|
|
||||||
TST r12,#2 @ if (offset & 2)
|
TST r12,#2 @ if (offset & 2)
|
||||||
ADDNE r9, r9, r10,ASR #1 @ diff += r10>>1
|
ADDNE r9, r9, r10,ASR #1 @ diff += r10>>1
|
||||||
|
|
||||||
TST r12,#1 @ if (offset & 1)
|
TST r12,#1 @ if (offset & 1)
|
||||||
ADDNE r9, r9, r10,ASR #2 @ diff += r10>>2
|
ADDNE r9, r9, r10,ASR #2 @ diff += r10>>2
|
||||||
|
|
||||||
ADD r9, r9, r10,ASR #3 @ diff += r10>>3
|
ADD r9, r9, r10,ASR #3 @ diff += r10>>3
|
||||||
|
|
||||||
|
|
|
@ -27,25 +27,25 @@
|
||||||
|
|
||||||
namespace DS {
|
namespace DS {
|
||||||
|
|
||||||
void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
|
void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
|
||||||
int vsPitch, int vmScreenWidth, int textSurfacePitch) {
|
int vsPitch, int vmScreenWidth, int textSurfacePitch) {
|
||||||
|
|
||||||
|
|
||||||
if (height <= 0) height = 1;
|
if (height <= 0) height = 1;
|
||||||
if (width < 4) return;
|
if (width < 4) return;
|
||||||
|
|
||||||
|
|
||||||
width &= ~4;
|
width &= ~4;
|
||||||
// src = (const byte *) (((int) (src)) & (~4));
|
// src = (const byte *) (((int) (src)) & (~4));
|
||||||
// dst = (byte *) (((int) (dst)) & (~4));
|
// dst = (byte *) (((int) (dst)) & (~4));
|
||||||
// text = (const byte *) (((int) (text)) & (~4));
|
// text = (const byte *) (((int) (text)) & (~4));
|
||||||
|
|
||||||
asm ( "mov r5, %0\n" // Height
|
asm ( "mov r5, %0\n" // Height
|
||||||
"yLoop:\n"
|
"yLoop:\n"
|
||||||
"mov r3, #0\n" // X pos
|
"mov r3, #0\n" // X pos
|
||||||
|
|
||||||
"xLoop:\n"
|
"xLoop:\n"
|
||||||
|
|
||||||
"ldr r4, [%2, r3]\n" // Load text layer word
|
"ldr r4, [%2, r3]\n" // Load text layer word
|
||||||
"cmp r4, %5\n"
|
"cmp r4, %5\n"
|
||||||
"bne singleByteCompare\n"
|
"bne singleByteCompare\n"
|
||||||
|
@ -54,7 +54,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
|
||||||
"add r3, r3, #4\n"
|
"add r3, r3, #4\n"
|
||||||
"cmp r3, %1\n" // x == width?
|
"cmp r3, %1\n" // x == width?
|
||||||
"blt xLoop\n"
|
"blt xLoop\n"
|
||||||
|
|
||||||
"add %2, %2, %8\n" // src += vs->pitch
|
"add %2, %2, %8\n" // src += vs->pitch
|
||||||
"add %3, %3, %6\n" // dst += _vm->_screenWidth
|
"add %3, %3, %6\n" // dst += _vm->_screenWidth
|
||||||
"add %4, %4, %7\n" // text += _textSurface.pitch
|
"add %4, %4, %7\n" // text += _textSurface.pitch
|
||||||
|
@ -62,8 +62,8 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
|
||||||
"cmp r5, #0\n" // y == 0?
|
"cmp r5, #0\n" // y == 0?
|
||||||
"bne yLoop\n"
|
"bne yLoop\n"
|
||||||
"b end\n"
|
"b end\n"
|
||||||
|
|
||||||
|
|
||||||
"singleByteCompare:\n"
|
"singleByteCompare:\n"
|
||||||
"ldrb r4, [%2, r3]\n" // Load text byte
|
"ldrb r4, [%2, r3]\n" // Load text byte
|
||||||
"cmps r4, %5, lsr #24\n" // Compare with mask
|
"cmps r4, %5, lsr #24\n" // Compare with mask
|
||||||
|
@ -78,7 +78,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
|
||||||
"ldreqb r4, [%3, r3]\n" // Otherwise Load src byte
|
"ldreqb r4, [%3, r3]\n" // Otherwise Load src byte
|
||||||
"streqb r4, [%4, r3]\n" // Store it
|
"streqb r4, [%4, r3]\n" // Store it
|
||||||
"add r3, r3, #1\n"
|
"add r3, r3, #1\n"
|
||||||
|
|
||||||
"ldrb r4, [%2, r3]\n" // Load text byte
|
"ldrb r4, [%2, r3]\n" // Load text byte
|
||||||
"cmps r4, %5, lsr #24\n" // Compare with mask
|
"cmps r4, %5, lsr #24\n" // Compare with mask
|
||||||
"strneb r4, [%4, r3]\n" // Store if not equal
|
"strneb r4, [%4, r3]\n" // Store if not equal
|
||||||
|
@ -91,7 +91,7 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
|
||||||
"strneb r4, [%4, r3]\n" // Store if not equal
|
"strneb r4, [%4, r3]\n" // Store if not equal
|
||||||
"ldreqb r4, [%3, r3]\n" // Otherwise Load src byte
|
"ldreqb r4, [%3, r3]\n" // Otherwise Load src byte
|
||||||
"streqb r4, [%4, r3]\n" // Store it
|
"streqb r4, [%4, r3]\n" // Store it
|
||||||
"add r3, r3, #1\n"
|
"add r3, r3, #1\n"
|
||||||
|
|
||||||
"cmps r3, %1\n" // x == width?
|
"cmps r3, %1\n" // x == width?
|
||||||
"blt xLoop\n" // Repeat
|
"blt xLoop\n" // Repeat
|
||||||
|
@ -101,10 +101,10 @@ void asmDrawStripToScreen(int height, int width, byte const* text, byte const* s
|
||||||
"sub r5, r5, #1\n" // y -= 1
|
"sub r5, r5, #1\n" // y -= 1
|
||||||
"cmp r5, #0\n" // y == 0?
|
"cmp r5, #0\n" // y == 0?
|
||||||
"bne yLoop\n"
|
"bne yLoop\n"
|
||||||
|
|
||||||
"end:\n"
|
"end:\n"
|
||||||
: /* no output registers */
|
: /* no output registers */
|
||||||
: "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)),
|
: "r" (height), "r" (width), "r" (text), "r" (src), "r" (dst), "r" (CHARSET_MASK_TRANSPARENCY | (CHARSET_MASK_TRANSPARENCY << 8) | (CHARSET_MASK_TRANSPARENCY << 16) | (CHARSET_MASK_TRANSPARENCY << 24)),
|
||||||
"r" (vsPitch), "r" (vmScreenWidth), "r" (textSurfacePitch)
|
"r" (vsPitch), "r" (vmScreenWidth), "r" (textSurfacePitch)
|
||||||
: "r5", "r3", "r4", "%2", "%3", "%4", "memory");
|
: "r5", "r3", "r4", "%2", "%3", "%4", "memory");
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) {
|
||||||
asm("ands r0, %3, #1\n"
|
asm("ands r0, %3, #1\n"
|
||||||
"addne %3, %3, #1\n"
|
"addne %3, %3, #1\n"
|
||||||
"bne roll2\n"
|
"bne roll2\n"
|
||||||
|
|
||||||
"yLoop2:\n"
|
"yLoop2:\n"
|
||||||
"ldr r0, [%2, #0]\n"
|
"ldr r0, [%2, #0]\n"
|
||||||
"str r0, [%0, #0]\n"
|
"str r0, [%0, #0]\n"
|
||||||
|
@ -131,7 +131,7 @@ void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height) {
|
||||||
"add %0, %0, %1\n"
|
"add %0, %0, %1\n"
|
||||||
"add %2, %2, %1\n"
|
"add %2, %2, %1\n"
|
||||||
"subs %3, %3, #2\n"
|
"subs %3, %3, #2\n"
|
||||||
"bne yLoop2\n"
|
"bne yLoop2\n"
|
||||||
|
|
||||||
: /* no output registers */
|
: /* no output registers */
|
||||||
: "r" (dst), "r" (dstPitch), "r" (src), "r" (height)
|
: "r" (dst), "r" (dstPitch), "r" (src), "r" (height)
|
||||||
|
@ -150,7 +150,7 @@ void ComputeDivBy5TableIFN()
|
||||||
for (int i=0; i<160; ++i)
|
for (int i=0; i<160; ++i)
|
||||||
{
|
{
|
||||||
DIV_BY_5[i] = (2*i+5)/10;
|
DIV_BY_5[i] = (2*i+5)/10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PERFECT_5_TO_4_RESCALING
|
#ifdef PERFECT_5_TO_4_RESCALING
|
||||||
|
@ -163,13 +163,13 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
|
||||||
u32 bs3 = s3 & 0x1F;
|
u32 bs3 = s3 & 0x1F;
|
||||||
u32 bs4 = s4 & 0x1F;
|
u32 bs4 = s4 & 0x1F;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
u32 gs0 = (s0 >> 5) & 0x1F;
|
u32 gs0 = (s0 >> 5) & 0x1F;
|
||||||
u32 gs1 = (s1 >> 5) & 0x1F;
|
u32 gs1 = (s1 >> 5) & 0x1F;
|
||||||
u32 gs2 = (s2 >> 5) & 0x1F;
|
u32 gs2 = (s2 >> 5) & 0x1F;
|
||||||
u32 gs3 = (s3 >> 5) & 0x1F;
|
u32 gs3 = (s3 >> 5) & 0x1F;
|
||||||
u32 gs4 = (s4 >> 5) & 0x1F;
|
u32 gs4 = (s4 >> 5) & 0x1F;
|
||||||
|
|
||||||
u32 rs0 = (s0 >> 10) & 0x1F;
|
u32 rs0 = (s0 >> 10) & 0x1F;
|
||||||
u32 rs1 = (s1 >> 10) & 0x1F;
|
u32 rs1 = (s1 >> 10) & 0x1F;
|
||||||
u32 rs2 = (s2 >> 10) & 0x1F;
|
u32 rs2 = (s2 >> 10) & 0x1F;
|
||||||
|
@ -191,22 +191,22 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
|
||||||
asm("and %0, %2, %1, lsr #10" : "=r"(rs3) : "r"(s3), "r"(mask) : );
|
asm("and %0, %2, %1, lsr #10" : "=r"(rs3) : "r"(s3), "r"(mask) : );
|
||||||
asm("and %0, %2, %1, lsr #10" : "=r"(rs4) : "r"(s4), "r"(mask) : );
|
asm("and %0, %2, %1, lsr #10" : "=r"(rs4) : "r"(s4), "r"(mask) : );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u32 rd0 = 4*rs0 + rs1;
|
u32 rd0 = 4*rs0 + rs1;
|
||||||
u32 rd1 = 2*rs1 + rs1 + 2*rs2;
|
u32 rd1 = 2*rs1 + rs1 + 2*rs2;
|
||||||
u32 rd2 = 2*rs2 + 2*rs3 + rs3;
|
u32 rd2 = 2*rs2 + 2*rs3 + rs3;
|
||||||
u32 rd3 = rs3 + 4*rs4;
|
u32 rd3 = rs3 + 4*rs4;
|
||||||
|
|
||||||
u32 gd0 = 4*gs0 + gs1;
|
u32 gd0 = 4*gs0 + gs1;
|
||||||
u32 gd1 = 2*gs1 + gs1 + 2*gs2;
|
u32 gd1 = 2*gs1 + gs1 + 2*gs2;
|
||||||
u32 gd2 = 2*gs2 + 2*gs3 + gs3;
|
u32 gd2 = 2*gs2 + 2*gs3 + gs3;
|
||||||
u32 gd3 = gs3 + 4*gs4;
|
u32 gd3 = gs3 + 4*gs4;
|
||||||
|
|
||||||
u32 bd0 = 4*bs0 + bs1;
|
u32 bd0 = 4*bs0 + bs1;
|
||||||
u32 bd1 = 2*bs1 + bs1 + 2*bs2;
|
u32 bd1 = 2*bs1 + bs1 + 2*bs2;
|
||||||
u32 bd2 = 2*bs2 + 2*bs3 + bs3;
|
u32 bd2 = 2*bs2 + 2*bs3 + bs3;
|
||||||
u32 bd3 = bs3 + 4*bs4;
|
u32 bd3 = bs3 + 4*bs4;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Offsetting for correct rounding
|
// Offsetting for correct rounding
|
||||||
rd0 = rd0*2+5; rd1 = rd1*2+5; rd2 = rd2*2+5; rd3 = rd3*2+5;
|
rd0 = rd0*2+5; rd1 = rd1*2+5; rd2 = rd2*2+5; rd3 = rd3*2+5;
|
||||||
|
@ -217,14 +217,14 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
|
||||||
gd0 = (gd0 * 51) >> 9; gd1 = (gd1 * 51) >> 9; gd2 = (gd2 * 51) >> 9; gd3 = (gd3 * 51) >> 9;
|
gd0 = (gd0 * 51) >> 9; gd1 = (gd1 * 51) >> 9; gd2 = (gd2 * 51) >> 9; gd3 = (gd3 * 51) >> 9;
|
||||||
bd0 = (bd0 * 51) >> 9; bd1 = (bd1 * 51) >> 9; bd2 = (bd2 * 51) >> 9; bd3 = (bd3 * 51) >> 9;
|
bd0 = (bd0 * 51) >> 9; bd1 = (bd1 * 51) >> 9; bd2 = (bd2 * 51) >> 9; bd3 = (bd3 * 51) >> 9;
|
||||||
#else
|
#else
|
||||||
rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
|
rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1]; rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
|
||||||
gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
|
gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1]; gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
|
||||||
bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
|
bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1]; bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
|
u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
|
||||||
u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
|
u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
|
||||||
|
|
||||||
((u32*)dest)[0] = d10;
|
((u32*)dest)[0] = d10;
|
||||||
((u32*)dest)[1] = d32;
|
((u32*)dest)[1] = d32;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +233,7 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
|
||||||
u16* dest)
|
u16* dest)
|
||||||
{
|
{
|
||||||
static const u32 MASK = 0x03E07C1F;
|
static const u32 MASK = 0x03E07C1F;
|
||||||
|
|
||||||
u32 argbargbs0 = u32(s0) | (u32(s0) << 16);
|
u32 argbargbs0 = u32(s0) | (u32(s0) << 16);
|
||||||
u32 argbargbs1 = u32(s1) | (u32(s1) << 16);
|
u32 argbargbs1 = u32(s1) | (u32(s1) << 16);
|
||||||
u32 argbargbs2 = u32(s2) | (u32(s2) << 16);
|
u32 argbargbs2 = u32(s2) | (u32(s2) << 16);
|
||||||
|
@ -245,32 +245,32 @@ static inline void RescaleBlock_5x1555_To_4x1555( u16 s0, u16 s1, u16 s2, u16 s3
|
||||||
u32 grbs2 = argbargbs2 & MASK;
|
u32 grbs2 = argbargbs2 & MASK;
|
||||||
u32 grbs3 = argbargbs3 & MASK;
|
u32 grbs3 = argbargbs3 & MASK;
|
||||||
u32 grbs4 = argbargbs4 & MASK;
|
u32 grbs4 = argbargbs4 & MASK;
|
||||||
|
|
||||||
u32 grbd0 = (3*grbs0 + grbs1) >> 2;
|
u32 grbd0 = (3*grbs0 + grbs1) >> 2;
|
||||||
u32 grbd1 = ( grbs1 + grbs2) >> 1;
|
u32 grbd1 = ( grbs1 + grbs2) >> 1;
|
||||||
u32 grbd2 = ( grbs2 + grbs3) >> 1;
|
u32 grbd2 = ( grbs2 + grbs3) >> 1;
|
||||||
u32 grbd3 = ( grbs3 + 3*grbs4) >> 2;
|
u32 grbd3 = ( grbs3 + 3*grbs4) >> 2;
|
||||||
|
|
||||||
grbd0 &= MASK;
|
grbd0 &= MASK;
|
||||||
grbd1 &= MASK;
|
grbd1 &= MASK;
|
||||||
grbd2 &= MASK;
|
grbd2 &= MASK;
|
||||||
grbd3 &= MASK;
|
grbd3 &= MASK;
|
||||||
|
|
||||||
u32 d0 = grbd0 | (grbd0 >> 16);
|
u32 d0 = grbd0 | (grbd0 >> 16);
|
||||||
u32 d1 = grbd1 | (grbd1 >> 16);
|
u32 d1 = grbd1 | (grbd1 >> 16);
|
||||||
u32 d2 = grbd2 | (grbd2 >> 16);
|
u32 d2 = grbd2 | (grbd2 >> 16);
|
||||||
u32 d3 = grbd3 | (grbd3 >> 16);
|
u32 d3 = grbd3 | (grbd3 >> 16);
|
||||||
|
|
||||||
d0 &= 0xFFFF;
|
d0 &= 0xFFFF;
|
||||||
d1 &= 0xFFFF;
|
d1 &= 0xFFFF;
|
||||||
d2 &= 0xFFFF;
|
d2 &= 0xFFFF;
|
||||||
d3 &= 0xFFFF;
|
d3 &= 0xFFFF;
|
||||||
|
|
||||||
d0 |= 0x8000;
|
d0 |= 0x8000;
|
||||||
d1 |= 0x8000;
|
d1 |= 0x8000;
|
||||||
d2 |= 0x8000;
|
d2 |= 0x8000;
|
||||||
d3 |= 0x8000;
|
d3 |= 0x8000;
|
||||||
|
|
||||||
dest[0] = d0;
|
dest[0] = d0;
|
||||||
dest[1] = d1;
|
dest[1] = d1;
|
||||||
dest[2] = d2;
|
dest[2] = d2;
|
||||||
|
@ -287,13 +287,13 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
|
||||||
u32 bd0 = (d0 << 24) >> 24;
|
u32 bd0 = (d0 << 24) >> 24;
|
||||||
u32 bd1 = (d1 << 24) >> 24;
|
u32 bd1 = (d1 << 24) >> 24;
|
||||||
u32 gd0 = (d0 << 16) >> 24;
|
u32 gd0 = (d0 << 16) >> 24;
|
||||||
u32 gd1 = (d1 << 16) >> 24;
|
u32 gd1 = (d1 << 16) >> 24;
|
||||||
u32 rd0 = (d0 >> 16);
|
u32 rd0 = (d0 >> 16);
|
||||||
u32 rd1 = (d1 >> 16);
|
u32 rd1 = (d1 >> 16);
|
||||||
|
|
||||||
rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1];
|
rd0 = DIV_BY_5[rd0]; rd1 = DIV_BY_5[rd1];
|
||||||
gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1];
|
gd0 = DIV_BY_5[gd0]; gd1 = DIV_BY_5[gd1];
|
||||||
bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];
|
bd0 = DIV_BY_5[bd0]; bd1 = DIV_BY_5[bd1];
|
||||||
u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
|
u32 d10 = 0x80008000 | (rd1 << 26) | (gd1 << 21) | (bd1 << 16) | (rd0 << 10) | (gd0 << 5) | bd0;
|
||||||
((u32*)dest)[0] = d10;
|
((u32*)dest)[0] = d10;
|
||||||
|
|
||||||
|
@ -307,11 +307,11 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
|
||||||
u32 rd2 = (d2 >> 16);
|
u32 rd2 = (d2 >> 16);
|
||||||
u32 rd3 = (d3 >> 16);
|
u32 rd3 = (d3 >> 16);
|
||||||
|
|
||||||
rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
|
rd2 = DIV_BY_5[rd2]; rd3 = DIV_BY_5[rd3];
|
||||||
gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
|
gd2 = DIV_BY_5[gd2]; gd3 = DIV_BY_5[gd3];
|
||||||
bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
|
bd2 = DIV_BY_5[bd2]; bd3 = DIV_BY_5[bd3];
|
||||||
u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
|
u32 d32 = 0x80008000 | (rd3 << 26) | (gd3 << 21) | (bd3 << 16) | (rd2 << 10) | (gd2 << 5) | bd2;
|
||||||
|
|
||||||
((u32*)dest)[1] = d32;
|
((u32*)dest)[1] = d32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ static inline void RescaleBlock_5x8888_To_4x1555( u32 s0, u32 s1, u32 s2, u32 s3
|
||||||
static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u32* palette)
|
static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const u8* src, const u32* palette)
|
||||||
{
|
{
|
||||||
ComputeDivBy5TableIFN();
|
ComputeDivBy5TableIFN();
|
||||||
|
|
||||||
for (size_t i=0; i<64; ++i)
|
for (size_t i=0; i<64; ++i)
|
||||||
{
|
{
|
||||||
u32 s0 = palette[src[5*i+0]];
|
u32 s0 = palette[src[5*i+0]];
|
||||||
|
@ -353,7 +353,7 @@ static inline void Rescale_320xPAL8Scanline_To_256x1555Scanline(u16* dest, const
|
||||||
static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const u16* src)
|
static inline void Rescale_320x1555Scanline_To_256x1555Scanline(u16* dest, const u16* src)
|
||||||
{
|
{
|
||||||
ComputeDivBy5TableIFN();
|
ComputeDivBy5TableIFN();
|
||||||
|
|
||||||
for (size_t i=0; i<64; ++i)
|
for (size_t i=0; i<64; ++i)
|
||||||
{
|
{
|
||||||
u16 s0 = src[5*i+0];
|
u16 s0 = src[5*i+0];
|
||||||
|
@ -384,7 +384,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri
|
||||||
|
|
||||||
for (size_t i=0; i<200; ++i)
|
for (size_t i=0; i<200; ++i)
|
||||||
{
|
{
|
||||||
Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
|
Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -396,7 +396,7 @@ void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStri
|
||||||
|
|
||||||
for (size_t i=0; i<200; ++i)
|
for (size_t i=0; i<200; ++i)
|
||||||
{
|
{
|
||||||
Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
|
Rescale_320xPAL8Scanline_To_256x1555Scanline(dest + i*destStride, src + i *srcStride, fastRam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _BLITTERS_H_
|
#ifndef _BLITTERS_H_
|
||||||
#define _BLITTERS_H_
|
#define _BLITTERS_H_
|
||||||
|
|
||||||
|
@ -29,22 +29,22 @@
|
||||||
|
|
||||||
namespace DS {
|
namespace DS {
|
||||||
|
|
||||||
void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
|
void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
|
||||||
int vsPitch, int vmScreenWidth, int textSurfacePitch);
|
int vsPitch, int vmScreenWidth, int textSurfacePitch);
|
||||||
void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
|
void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
|
||||||
void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette);
|
void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette);
|
||||||
void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
|
void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
|
void asmDrawStripToScreen(int height, int width, byte const* text, byte const* src, byte* dst,
|
||||||
int vsPitch, int vmScreenWidth, int textSurfacePitch);
|
int vsPitch, int vmScreenWidth, int textSurfacePitch);
|
||||||
void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
|
void asmCopy8Col(byte* dst, int dstPitch, const byte* src, int height);
|
||||||
void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette);
|
void Rescale_320x256xPAL8_To_256x256x1555(u16* dest, const u8* src, int destStride, int srcStride, const u16* palette, u32 numLines);
|
||||||
void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
|
void Rescale_320x256x1555_To_256x256x1555(u16* dest, const u16* src, int destStride, int srcStride);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
@ @author Robin Watts (robin@wss.co.uk)
|
@ @author Robin Watts (robin@wss.co.uk)
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
|
||||||
.global asmDrawStripToScreen
|
.global asmDrawStripToScreen
|
||||||
.global asmCopy8Col
|
.global asmCopy8Col
|
||||||
.global Rescale_320x256xPAL8_To_256x256x1555
|
.global Rescale_320x256xPAL8_To_256x256x1555
|
||||||
|
@ -142,7 +142,7 @@ asmCopy8Col:
|
||||||
@ r3 = height
|
@ r3 = height
|
||||||
STMFD r13!,{r14}
|
STMFD r13!,{r14}
|
||||||
SUB r1,r1,#4
|
SUB r1,r1,#4
|
||||||
|
|
||||||
TST r3,#1
|
TST r3,#1
|
||||||
ADDNE r3,r3,#1
|
ADDNE r3,r3,#1
|
||||||
BNE roll2
|
BNE roll2
|
||||||
|
@ -177,7 +177,7 @@ Rescale_320x256x1555_To_256x256x1555:
|
||||||
@ r2 = dstStride
|
@ r2 = dstStride
|
||||||
@ r3 = srcStride
|
@ r3 = srcStride
|
||||||
STMFD r13!,{r4-r5,r8-r11,r14}
|
STMFD r13!,{r4-r5,r8-r11,r14}
|
||||||
|
|
||||||
SUB r2,r2,#64*5 @ srcStride -= line length
|
SUB r2,r2,#64*5 @ srcStride -= line length
|
||||||
SUB r3,r3,#64*4 @ dstStride -= line length
|
SUB r3,r3,#64*4 @ dstStride -= line length
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ Rescale_320x256x1555_To_256x256x1555:
|
||||||
MOV r5, #200 @ r5 = y
|
MOV r5, #200 @ r5 = y
|
||||||
yLoop3:
|
yLoop3:
|
||||||
MOV r4, #64 @ r4 = x
|
MOV r4, #64 @ r4 = x
|
||||||
xLoop3:
|
xLoop3:
|
||||||
LDRH r9, [r0],#2 @ r9 = src0
|
LDRH r9, [r0],#2 @ r9 = src0
|
||||||
LDRH r10,[r0],#2 @ r10= src1
|
LDRH r10,[r0],#2 @ r10= src1
|
||||||
LDRH r11,[r0],#2 @ r11= src2
|
LDRH r11,[r0],#2 @ r11= src2
|
||||||
|
@ -212,7 +212,7 @@ xLoop3:
|
||||||
ADD r11,r11,r12 @ r11= dst2
|
ADD r11,r11,r12 @ r11= dst2
|
||||||
ADD r12,r12,r14 @ r12= src3 + src4
|
ADD r12,r12,r14 @ r12= src3 + src4
|
||||||
ADD r12,r12,r14,LSL #1 @ r12= src3 + src4*3 = dst3<<2
|
ADD r12,r12,r14,LSL #1 @ r12= src3 + src4*3 = dst3<<2
|
||||||
|
|
||||||
AND r9, r8, r9, LSR #2 @ r9 = dst0 (split)
|
AND r9, r8, r9, LSR #2 @ r9 = dst0 (split)
|
||||||
AND r10,r8, r10,LSR #1 @ r10= dst1 (split)
|
AND r10,r8, r10,LSR #1 @ r10= dst1 (split)
|
||||||
AND r11,r8, r11,LSR #1 @ r11= dst2 (split)
|
AND r11,r8, r11,LSR #1 @ r11= dst2 (split)
|
||||||
|
@ -227,7 +227,7 @@ xLoop3:
|
||||||
ORR r10,r10,#0x8000
|
ORR r10,r10,#0x8000
|
||||||
ORR r11,r11,#0x8000
|
ORR r11,r11,#0x8000
|
||||||
ORR r12,r12,#0x8000
|
ORR r12,r12,#0x8000
|
||||||
|
|
||||||
STRH r9, [r1],#2
|
STRH r9, [r1],#2
|
||||||
STRH r10,[r1],#2
|
STRH r10,[r1],#2
|
||||||
STRH r11,[r1],#2
|
STRH r11,[r1],#2
|
||||||
|
@ -235,7 +235,7 @@ xLoop3:
|
||||||
|
|
||||||
SUBS r4,r4,#1
|
SUBS r4,r4,#1
|
||||||
BGT xLoop3
|
BGT xLoop3
|
||||||
|
|
||||||
ADD r0,r0,r2,LSL #1
|
ADD r0,r0,r2,LSL #1
|
||||||
ADD r1,r2,r3,LSL #1
|
ADD r1,r2,r3,LSL #1
|
||||||
SUBS r5,r5,#1
|
SUBS r5,r5,#1
|
||||||
|
@ -266,7 +266,7 @@ Rescale_320x256xPAL8_To_256x256x1555:
|
||||||
ORR r8, r8,#0x00007C00
|
ORR r8, r8,#0x00007C00
|
||||||
ORR r8, r8,#0x03E00000 @ r8 = mask
|
ORR r8, r8,#0x03E00000 @ r8 = mask
|
||||||
LDR r9, [r13,#7*4] @ r9 = palette
|
LDR r9, [r13,#7*4] @ r9 = palette
|
||||||
|
|
||||||
SUB r13,r13,#256*4 @ r13 = 1K of space on the stack.
|
SUB r13,r13,#256*4 @ r13 = 1K of space on the stack.
|
||||||
MOV r5, r13 @ r5 points to this space
|
MOV r5, r13 @ r5 points to this space
|
||||||
MOV r14,#256
|
MOV r14,#256
|
||||||
|
@ -277,14 +277,14 @@ palLoop:
|
||||||
AND r10,r10,r8 @ r10 = separated palette entry
|
AND r10,r10,r8 @ r10 = separated palette entry
|
||||||
STR r10,[r5], #4
|
STR r10,[r5], #4
|
||||||
BGT palLoop
|
BGT palLoop
|
||||||
|
|
||||||
SUB r2,r2,#64*5 @ srcStride -= line length
|
SUB r2,r2,#64*5 @ srcStride -= line length
|
||||||
SUB r3,r3,#64*4 @ dstStride -= line length
|
SUB r3,r3,#64*4 @ dstStride -= line length
|
||||||
|
|
||||||
MOV r5,#200 @ r5 = y
|
MOV r5,#200 @ r5 = y
|
||||||
yLoop4:
|
yLoop4:
|
||||||
MOV r4,#64 @ r4 = x
|
MOV r4,#64 @ r4 = x
|
||||||
xLoop4:
|
xLoop4:
|
||||||
LDRB r9, [r0],#1 @ r9 = src0
|
LDRB r9, [r0],#1 @ r9 = src0
|
||||||
LDRB r10,[r0],#1 @ r10= src1
|
LDRB r10,[r0],#1 @ r10= src1
|
||||||
LDRB r11,[r0],#1 @ r11= src2
|
LDRB r11,[r0],#1 @ r11= src2
|
||||||
|
@ -303,7 +303,7 @@ xLoop4:
|
||||||
ADD r11,r11,r12 @ r11= dst2
|
ADD r11,r11,r12 @ r11= dst2
|
||||||
ADD r12,r12,r14 @ r12= src3 + src4
|
ADD r12,r12,r14 @ r12= src3 + src4
|
||||||
ADD r12,r12,r14,LSL #1 @ r12= src3 + src4*3 = dst3<<2
|
ADD r12,r12,r14,LSL #1 @ r12= src3 + src4*3 = dst3<<2
|
||||||
|
|
||||||
AND r9, r8, r9, LSR #2 @ r9 = dst0 (split)
|
AND r9, r8, r9, LSR #2 @ r9 = dst0 (split)
|
||||||
AND r10,r8, r10,LSR #1 @ r10= dst1 (split)
|
AND r10,r8, r10,LSR #1 @ r10= dst1 (split)
|
||||||
AND r11,r8, r11,LSR #1 @ r11= dst2 (split)
|
AND r11,r8, r11,LSR #1 @ r11= dst2 (split)
|
||||||
|
@ -318,7 +318,7 @@ xLoop4:
|
||||||
ORR r10,r10,#0x8000
|
ORR r10,r10,#0x8000
|
||||||
ORR r11,r11,#0x8000
|
ORR r11,r11,#0x8000
|
||||||
ORR r12,r12,#0x8000
|
ORR r12,r12,#0x8000
|
||||||
|
|
||||||
STRH r9, [r1],#2
|
STRH r9, [r1],#2
|
||||||
STRH r10,[r1],#2
|
STRH r10,[r1],#2
|
||||||
STRH r11,[r1],#2
|
STRH r11,[r1],#2
|
||||||
|
@ -326,7 +326,7 @@ xLoop4:
|
||||||
|
|
||||||
SUBS r4,r4,#1
|
SUBS r4,r4,#1
|
||||||
BGT xLoop4
|
BGT xLoop4
|
||||||
|
|
||||||
ADD r0,r0,r2
|
ADD r0,r0,r2
|
||||||
ADD r1,r2,r3,LSL #1
|
ADD r1,r2,r3,LSL #1
|
||||||
SUBS r5,r5,#1
|
SUBS r5,r5,#1
|
||||||
|
@ -336,4 +336,4 @@ xLoop4:
|
||||||
|
|
||||||
LDMFD r13!,{r4-r5,r8-r11,PC}
|
LDMFD r13!,{r4-r5,r8-r11,PC}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -251,8 +251,8 @@ xLoop3:
|
||||||
@ const u8 *src,
|
@ const u8 *src,
|
||||||
@ int dstStride,
|
@ int dstStride,
|
||||||
@ int srcStride,
|
@ int srcStride,
|
||||||
@ const u16 *pal);
|
@ const u16 *pal,
|
||||||
@
|
@ u32 numLines);
|
||||||
Rescale_320x256xPAL8_To_256x256x1555:
|
Rescale_320x256xPAL8_To_256x256x1555:
|
||||||
@ r0 = dst
|
@ r0 = dst
|
||||||
@ r1 = src
|
@ r1 = src
|
||||||
|
@ -263,6 +263,7 @@ Rescale_320x256xPAL8_To_256x256x1555:
|
||||||
ORR r8, r8,#0x0000FC00
|
ORR r8, r8,#0x0000FC00
|
||||||
ORR r8, r8,#0x03E00000 @ r8 = mask
|
ORR r8, r8,#0x03E00000 @ r8 = mask
|
||||||
LDR r9, [r13,#9*4] @ r9 = palette
|
LDR r9, [r13,#9*4] @ r9 = palette
|
||||||
|
LDR r7, [r13,#10*4] @ r7 = numLines
|
||||||
|
|
||||||
SUB r13,r13,#256*4 @ r13 = 1K of space on the stack.
|
SUB r13,r13,#256*4 @ r13 = 1K of space on the stack.
|
||||||
MOV r5, r13 @ r5 points to this space
|
MOV r5, r13 @ r5 points to this space
|
||||||
|
@ -280,7 +281,7 @@ palLoop:
|
||||||
SUB r3,r3,#64*5 @ dstStride -= line length
|
SUB r3,r3,#64*5 @ dstStride -= line length
|
||||||
|
|
||||||
MOV r14,#0xFF @ r14= 255
|
MOV r14,#0xFF @ r14= 255
|
||||||
MOV r5,#200 @ r5 = y
|
MOV r5,r7 @ r5 = numLines
|
||||||
yLoop4:
|
yLoop4:
|
||||||
MOV r4,#16 @ r4 = x
|
MOV r4,#16 @ r4 = x
|
||||||
xLoop4:
|
xLoop4:
|
||||||
|
@ -292,7 +293,7 @@ xLoop4:
|
||||||
ADD r6, r6, r6, LSL #1 @ r6 = 3*pal[src0]
|
ADD r6, r6, r6, LSL #1 @ r6 = 3*pal[src0]
|
||||||
AND r9, r14,r10,LSR #16 @ r9 = src2
|
AND r9, r14,r10,LSR #16 @ r9 = src2
|
||||||
LDR r9, [r13,r9, LSL #2] @ r9 = pal[src2]
|
LDR r9, [r13,r9, LSL #2] @ r9 = pal[src2]
|
||||||
MOV r10,r10,LSR #24 @ r10= src3
|
MOV r10,r10,LSR #24 @ r10= src3
|
||||||
LDR r10,[r13,r10,LSL #2] @ r10= pal[src3]
|
LDR r10,[r13,r10,LSL #2] @ r10= pal[src3]
|
||||||
ADD r6, r6, r7 @ r6 = dst0<<2
|
ADD r6, r6, r7 @ r6 = dst0<<2
|
||||||
AND r6, r8, r6, LSR #2 @ r6 = dst0 (split)
|
AND r6, r8, r6, LSR #2 @ r6 = dst0 (split)
|
||||||
|
@ -322,7 +323,7 @@ xLoop4:
|
||||||
ADD r6, r6, r6, LSL #1 @ r6 = 3*pal[src5]
|
ADD r6, r6, r6, LSL #1 @ r6 = 3*pal[src5]
|
||||||
MOV r9, r11,LSR #24 @ r9 = src7
|
MOV r9, r11,LSR #24 @ r9 = src7
|
||||||
LDR r9, [r13,r9, LSL #2] @ r9 = pal[src7]
|
LDR r9, [r13,r9, LSL #2] @ r9 = pal[src7]
|
||||||
AND r10,r14,r12 @ r10= src8
|
AND r10,r14,r12 @ r10= src8
|
||||||
LDR r10,[r13,r10,LSL #2] @ r10= pal[src8]
|
LDR r10,[r13,r10,LSL #2] @ r10= pal[src8]
|
||||||
ADD r6, r6, r7 @ r6 = dst4<<2
|
ADD r6, r6, r7 @ r6 = dst4<<2
|
||||||
AND r6, r8, r6, LSR #2 @ r6 = dst4 (split)
|
AND r6, r8, r6, LSR #2 @ r6 = dst4 (split)
|
||||||
|
@ -354,7 +355,7 @@ xLoop4:
|
||||||
ADD r6, r6, r6, LSL #1 @ r6 = 3*pal[src10]
|
ADD r6, r6, r6, LSL #1 @ r6 = 3*pal[src10]
|
||||||
AND r9, r14,r10 @ r9 = src12
|
AND r9, r14,r10 @ r9 = src12
|
||||||
LDR r9, [r13,r9, LSL #2] @ r9 = pal[src12]
|
LDR r9, [r13,r9, LSL #2] @ r9 = pal[src12]
|
||||||
AND r12,r14,r10,LSR #8 @ r11= src13
|
AND r12,r14,r10,LSR #8 @ r11= src13
|
||||||
LDR r12,[r13,r12,LSL #2] @ r11= pal[src13]
|
LDR r12,[r13,r12,LSL #2] @ r11= pal[src13]
|
||||||
ADD r6, r6, r7 @ r6 = dst8<<2
|
ADD r6, r6, r7 @ r6 = dst8<<2
|
||||||
AND r6, r8, r6, LSR #2 @ r6 = dst8 (split)
|
AND r6, r8, r6, LSR #2 @ r6 = dst8 (split)
|
||||||
|
@ -384,7 +385,7 @@ xLoop4:
|
||||||
ADD r6, r6, r6, LSL #1 @ r6 = 3*pal[src15]
|
ADD r6, r6, r6, LSL #1 @ r6 = 3*pal[src15]
|
||||||
AND r9, r14,r11,LSR #8 @ r9 = src17
|
AND r9, r14,r11,LSR #8 @ r9 = src17
|
||||||
LDR r9, [r13,r9, LSL #2] @ r9 = pal[src17]
|
LDR r9, [r13,r9, LSL #2] @ r9 = pal[src17]
|
||||||
AND r12,r14,r11,LSR #16 @ r11= src18
|
AND r12,r14,r11,LSR #16 @ r11= src18
|
||||||
LDR r12,[r13,r12,LSL #2] @ r11= pal[src18]
|
LDR r12,[r13,r12,LSL #2] @ r11= pal[src18]
|
||||||
ADD r6, r6, r7 @ r6 = dst12<<2
|
ADD r6, r6, r7 @ r6 = dst12<<2
|
||||||
AND r6, r8, r6, LSR #2 @ r6 = dst12 (split)
|
AND r6, r8, r6, LSR #2 @ r6 = dst12 (split)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cdaudio.h"
|
#include "cdaudio.h"
|
||||||
#include "ds-fs.h"
|
#include "ds-fs.h"
|
||||||
#include "config-manager.h"
|
#include "config-manager.h"
|
||||||
|
@ -53,14 +53,14 @@ struct WaveHeader {
|
||||||
u16 fmtExtraData; // Number of extra fmt bytes
|
u16 fmtExtraData; // Number of extra fmt bytes
|
||||||
u16 fmtExtra; // Samples per block (only for IMA-ADPCM files)
|
u16 fmtExtra; // Samples per block (only for IMA-ADPCM files)
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct chunkHeader {
|
struct chunkHeader {
|
||||||
char name[4];
|
char name[4];
|
||||||
u32 size;
|
u32 size;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
struct Header {
|
struct Header {
|
||||||
s16 firstSample;
|
s16 firstSample;
|
||||||
char stepTableIndex;
|
char stepTableIndex;
|
||||||
char reserved;
|
char reserved;
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
@ -112,7 +112,7 @@ void decompressBlock();
|
||||||
|
|
||||||
|
|
||||||
void allocBuffers() {
|
void allocBuffers() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setActive(bool active) {
|
void setActive(bool active) {
|
||||||
|
@ -125,17 +125,17 @@ bool getActive() {
|
||||||
|
|
||||||
void playTrack(int track, int numLoops, int startFrame, int duration) {
|
void playTrack(int track, int numLoops, int startFrame, int duration) {
|
||||||
Common::String path = ConfMan.get("path");
|
Common::String path = ConfMan.get("path");
|
||||||
|
|
||||||
if (isPlayingFlag) {
|
if (isPlayingFlag) {
|
||||||
stopTrack();
|
stopTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trackStartsAt2) {
|
if (trackStartsAt2) {
|
||||||
track++;
|
track++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char str[100];
|
char str[100];
|
||||||
|
|
||||||
if (path[strlen(path.c_str()) - 1] == '/') {
|
if (path[strlen(path.c_str()) - 1] == '/') {
|
||||||
|
@ -145,50 +145,50 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
|
||||||
sprintf(str, "/track%d.wav", track);
|
sprintf(str, "/track%d.wav", track);
|
||||||
path = path + str;
|
path = path + str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//1820160
|
//1820160
|
||||||
|
|
||||||
file = DS::std_fopen(path.c_str(), "rb");
|
file = DS::std_fopen(path.c_str(), "rb");
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
consolePrintf("Failed to open %s!\n", path.c_str());
|
consolePrintf("Failed to open %s!\n", path.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file);
|
DS::std_fread((const void *) &waveHeader, sizeof(waveHeader), 1, file);
|
||||||
|
|
||||||
consolePrintf("Playing track %d\n", track);
|
consolePrintf("Playing track %d\n", track);
|
||||||
consolePrintf("Format: %d\n", waveHeader.fmtFormatTag);
|
consolePrintf("Format: %d\n", waveHeader.fmtFormatTag);
|
||||||
consolePrintf("Rate : %d\n", waveHeader.fmtSamPerSec);
|
consolePrintf("Rate : %d\n", waveHeader.fmtSamPerSec);
|
||||||
consolePrintf("Bits : %d\n", waveHeader.fmtBitsPerSam);
|
consolePrintf("Bits : %d\n", waveHeader.fmtBitsPerSam);
|
||||||
consolePrintf("BlkSz : %d\n", waveHeader.fmtExtra);
|
consolePrintf("BlkSz : %d\n", waveHeader.fmtExtra);
|
||||||
|
|
||||||
if ((waveHeader.fmtFormatTag != 17) && (waveHeader.fmtFormatTag != 20)) {
|
if ((waveHeader.fmtFormatTag != 17) && (waveHeader.fmtFormatTag != 20)) {
|
||||||
consolePrintf("Wave file is in the wrong format! You must use IMA-ADPCM 4-bit mono.\n");
|
consolePrintf("Wave file is in the wrong format! You must use IMA-ADPCM 4-bit mono.\n");
|
||||||
DS::std_fclose(file);
|
DS::std_fclose(file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int r = 0; r < 8; r++) {
|
for (int r = 0; r < 8; r++) {
|
||||||
IPC->adpcm.buffer[r] = (u8 * volatile) (decoderFormat *) malloc(waveHeader.fmtBlockAlign);
|
IPC->adpcm.buffer[r] = (u8 * volatile) (decoderFormat *) malloc(waveHeader.fmtBlockAlign);
|
||||||
IPC->adpcm.filled[r] = false;
|
IPC->adpcm.filled[r] = false;
|
||||||
IPC->adpcm.arm7Dirty[r] = false;
|
IPC->adpcm.arm7Dirty[r] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip chunks until we reach the data chunk
|
// Skip chunks until we reach the data chunk
|
||||||
chunkHeader chunk;
|
chunkHeader chunk;
|
||||||
DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
|
DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
|
||||||
|
|
||||||
while (!((chunk.name[0] == 'd') && (chunk.name[1] == 'a') && (chunk.name[2] == 't') && (chunk.name[3] == 'a'))) {
|
while (!((chunk.name[0] == 'd') && (chunk.name[1] == 'a') && (chunk.name[2] == 't') && (chunk.name[3] == 'a'))) {
|
||||||
DS::std_fseek(file, chunk.size, SEEK_CUR);
|
DS::std_fseek(file, chunk.size, SEEK_CUR);
|
||||||
DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
|
DS::std_fread((const void *) &chunk, sizeof(chunkHeader), 1, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
dataChunkStart = DS::std_ftell(file);
|
dataChunkStart = DS::std_ftell(file);
|
||||||
|
|
||||||
|
|
||||||
static bool started = false;
|
static bool started = false;
|
||||||
sampleNum = 0;
|
sampleNum = 0;
|
||||||
blockCount = 0;
|
blockCount = 0;
|
||||||
|
@ -206,35 +206,35 @@ void playTrack(int track, int numLoops, int startFrame, int duration) {
|
||||||
memset(audioBuffer, 0, BUFFER_SIZE * 2);
|
memset(audioBuffer, 0, BUFFER_SIZE * 2);
|
||||||
memset(decompressionBuffer, 0, waveHeader.fmtExtra * 2);
|
memset(decompressionBuffer, 0, waveHeader.fmtExtra * 2);
|
||||||
DS::playSound(audioBuffer, BUFFER_SIZE * 2, false, false, waveHeader.fmtSamPerSec);
|
DS::playSound(audioBuffer, BUFFER_SIZE * 2, false, false, waveHeader.fmtSamPerSec);
|
||||||
|
|
||||||
}
|
}
|
||||||
fillPos = (IPC->streamPlayingSection + 1) & 3;
|
fillPos = (IPC->streamPlayingSection + 1) & 3;
|
||||||
isPlayingFlag = true;
|
isPlayingFlag = true;
|
||||||
|
|
||||||
|
|
||||||
// Startframe is a 75Hz timer. Dunno why, since nothing else
|
// Startframe is a 75Hz timer. Dunno why, since nothing else
|
||||||
// seems to run at that rate.
|
// seems to run at that rate.
|
||||||
int tenths = (startFrame * 10) / 75;
|
int tenths = (startFrame * 10) / 75;
|
||||||
|
|
||||||
// Seek to the nearest block start to the start time
|
// Seek to the nearest block start to the start time
|
||||||
int samples = (tenths * waveHeader.fmtSamPerSec) / 10;
|
int samples = (tenths * waveHeader.fmtSamPerSec) / 10;
|
||||||
int block = samples / waveHeader.fmtExtra;
|
int block = samples / waveHeader.fmtExtra;
|
||||||
|
|
||||||
|
|
||||||
if (duration == 0) {
|
if (duration == 0) {
|
||||||
blocksLeft = 0;
|
blocksLeft = 0;
|
||||||
} else {
|
} else {
|
||||||
blocksLeft = ((((duration * 100) / 75) * (waveHeader.fmtSamPerSec)) / (waveHeader.fmtExtra) / 100) + 10;
|
blocksLeft = ((((duration * 100) / 75) * (waveHeader.fmtSamPerSec)) / (waveHeader.fmtExtra) / 100) + 10;
|
||||||
}
|
}
|
||||||
// consolePrintf("Playing %d blocks (%d)\n\n", blocksLeft, duration);
|
// consolePrintf("Playing %d blocks (%d)\n\n", blocksLeft, duration);
|
||||||
|
|
||||||
// No need to seek if we're starting from the beginning
|
// No need to seek if we're starting from the beginning
|
||||||
if (block != 0) {
|
if (block != 0) {
|
||||||
DS::std_fseek(file, dataChunkStart + block * waveHeader.fmtBlockAlign, SEEK_SET);
|
DS::std_fseek(file, dataChunkStart + block * waveHeader.fmtBlockAlign, SEEK_SET);
|
||||||
// consolePrintf("Startframe: %d msec: %d (%d,%d)\n", startFrame, tenthssec, samples, block);
|
// consolePrintf("Startframe: %d msec: %d (%d,%d)\n", startFrame, tenthssec, samples, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//decompressBlock();
|
//decompressBlock();
|
||||||
playNextBlock();
|
playNextBlock();
|
||||||
DS::CD::numLoops = numLoops;
|
DS::CD::numLoops = numLoops;
|
||||||
|
@ -252,21 +252,21 @@ extern "C" void ARM_adcpm(int *block, int len, int stepTableIndex,
|
||||||
void decompressBlock() {
|
void decompressBlock() {
|
||||||
int block[2048];
|
int block[2048];
|
||||||
bool loop = false;
|
bool loop = false;
|
||||||
|
|
||||||
blockCount++;
|
blockCount++;
|
||||||
|
|
||||||
if (blockCount < 10) return;
|
if (blockCount < 10) return;
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
DS::std_fread((const void *) &blockHeader, sizeof(blockHeader), 1, file);
|
DS::std_fread((const void *) &blockHeader, sizeof(blockHeader), 1, file);
|
||||||
|
|
||||||
DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, file);
|
DS::std_fread(&block[0], waveHeader.fmtBlockAlign - sizeof(blockHeader), 1, file);
|
||||||
|
|
||||||
if (DS::std_feof(file) ) {
|
if (DS::std_feof(file) ) {
|
||||||
// Reached end of file, so loop
|
// Reached end of file, so loop
|
||||||
|
|
||||||
|
|
||||||
if ((numLoops == -1) || (numLoops > 1)) {
|
if ((numLoops == -1) || (numLoops > 1)) {
|
||||||
// Seek file to first packet
|
// Seek file to first packet
|
||||||
if (numLoops != -1) {
|
if (numLoops != -1) {
|
||||||
|
@ -283,14 +283,14 @@ void decompressBlock() {
|
||||||
stopTrack();
|
stopTrack();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
loop = false;
|
loop = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (loop);
|
} while (loop);
|
||||||
|
|
||||||
|
|
||||||
if (blocksLeft > 0) {
|
if (blocksLeft > 0) {
|
||||||
blocksLeft--;
|
blocksLeft--;
|
||||||
// consolePrintf("%d ", blocksLeft);
|
// consolePrintf("%d ", blocksLeft);
|
||||||
|
@ -305,37 +305,37 @@ void decompressBlock() {
|
||||||
blockHeader.stepTableIndex,
|
blockHeader.stepTableIndex,
|
||||||
blockHeader.firstSample,
|
blockHeader.firstSample,
|
||||||
decompressionBuffer);
|
decompressionBuffer);
|
||||||
#else
|
#else
|
||||||
// First sample is in header
|
// First sample is in header
|
||||||
decompressionBuffer[0] = blockHeader.firstSample;
|
decompressionBuffer[0] = blockHeader.firstSample;
|
||||||
|
|
||||||
// Set up initial table indeces
|
// Set up initial table indeces
|
||||||
int stepTableIndex = blockHeader.stepTableIndex;
|
int stepTableIndex = blockHeader.stepTableIndex;
|
||||||
int prevSample = blockHeader.firstSample;
|
int prevSample = blockHeader.firstSample;
|
||||||
|
|
||||||
// consolePrintf("Decompressing block step=%d fs=%d\n", stepTableIndex, prevSample);
|
// consolePrintf("Decompressing block step=%d fs=%d\n", stepTableIndex, prevSample);
|
||||||
|
|
||||||
for (int r = 0; r < waveHeader.fmtExtra - 1; r++) {
|
for (int r = 0; r < waveHeader.fmtExtra - 1; r++) {
|
||||||
|
|
||||||
int word = block[r >> 3];
|
int word = block[r >> 3];
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
switch (7 - (r & 0x0007)) {
|
switch (7 - (r & 0x0007)) {
|
||||||
case 0: {
|
case 0: {
|
||||||
offset = (word & 0xF0000000) >> 28;
|
offset = (word & 0xF0000000) >> 28;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 1: {
|
case 1: {
|
||||||
offset = (word & 0x0F000000) >> 24;
|
offset = (word & 0x0F000000) >> 24;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2: {
|
case 2: {
|
||||||
offset = (word & 0x00F00000) >> 20;
|
offset = (word & 0x00F00000) >> 20;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 3: {
|
case 3: {
|
||||||
offset = (word & 0x000F0000) >> 16;
|
offset = (word & 0x000F0000) >> 16;
|
||||||
break;
|
break;
|
||||||
|
@ -361,41 +361,41 @@ void decompressBlock() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int diff = 0;
|
int diff = 0;
|
||||||
|
|
||||||
if (offset & 4) {
|
if (offset & 4) {
|
||||||
diff = diff + stepTab[stepTableIndex];
|
diff = diff + stepTab[stepTableIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset & 2) {
|
if (offset & 2) {
|
||||||
diff = diff + (stepTab[stepTableIndex] >> 1);
|
diff = diff + (stepTab[stepTableIndex] >> 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset & 1) {
|
if (offset & 1) {
|
||||||
diff = diff + (stepTab[stepTableIndex] >> 2);
|
diff = diff + (stepTab[stepTableIndex] >> 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
diff = diff + (stepTab[stepTableIndex] >> 3);
|
diff = diff + (stepTab[stepTableIndex] >> 3);
|
||||||
|
|
||||||
if (offset & 8) {
|
if (offset & 8) {
|
||||||
diff = -diff;
|
diff = -diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
int newSample = prevSample + diff;
|
int newSample = prevSample + diff;
|
||||||
|
|
||||||
if (newSample > 32767) newSample = 32767;
|
if (newSample > 32767) newSample = 32767;
|
||||||
if (newSample < -32768) newSample = -32768;
|
if (newSample < -32768) newSample = -32768;
|
||||||
|
|
||||||
decompressionBuffer[r + 1] = newSample;
|
decompressionBuffer[r + 1] = newSample;
|
||||||
|
|
||||||
prevSample = newSample;
|
prevSample = newSample;
|
||||||
|
|
||||||
stepTableIndex += indexTab[offset];
|
stepTableIndex += indexTab[offset];
|
||||||
|
|
||||||
if (stepTableIndex > 88) stepTableIndex = 88;
|
if (stepTableIndex > 88) stepTableIndex = 88;
|
||||||
if (stepTableIndex < 0) stepTableIndex = 0;
|
if (stepTableIndex < 0) stepTableIndex = 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -404,21 +404,21 @@ void decompressBlock() {
|
||||||
void playNextBlock() {
|
void playNextBlock() {
|
||||||
if (!isPlayingFlag) return;
|
if (!isPlayingFlag) return;
|
||||||
int lastBlockId = -1;
|
int lastBlockId = -1;
|
||||||
|
|
||||||
while (IPC->adpcm.semaphore); // Wait for buffer to become free if needed
|
while (IPC->adpcm.semaphore); // Wait for buffer to become free if needed
|
||||||
IPC->adpcm.semaphore = true; // Lock the buffer structure to prevent clashing with the ARM7
|
IPC->adpcm.semaphore = true; // Lock the buffer structure to prevent clashing with the ARM7
|
||||||
// DC_FlushAll();
|
// DC_FlushAll();
|
||||||
|
|
||||||
//-8644, 25088
|
//-8644, 25088
|
||||||
for (int block = fillPos + 1; block < fillPos + 4; block++) {
|
for (int block = fillPos + 1; block < fillPos + 4; block++) {
|
||||||
|
|
||||||
int blockId = block & 3;
|
int blockId = block & 3;
|
||||||
|
|
||||||
if (IPC->streamFillNeeded[blockId]) {
|
if (IPC->streamFillNeeded[blockId]) {
|
||||||
|
|
||||||
IPC->streamFillNeeded[blockId] = false;
|
IPC->streamFillNeeded[blockId] = false;
|
||||||
// DC_FlushAll();
|
// DC_FlushAll();
|
||||||
|
|
||||||
/* if (!(REG_KEYINPUT & KEY_R)) {
|
/* if (!(REG_KEYINPUT & KEY_R)) {
|
||||||
//consolePrintf("Align: %d First: %d Step:%d Res:%d\n", waveHeader.fmtBlockAlign, blockHeader.firstSample, blockHeader.stepTableIndex, blockHeader.reserved);
|
//consolePrintf("Align: %d First: %d Step:%d Res:%d\n", waveHeader.fmtBlockAlign, blockHeader.firstSample, blockHeader.stepTableIndex, blockHeader.reserved);
|
||||||
consolePrintf("Filling buffer %d\n", blockId);
|
consolePrintf("Filling buffer %d\n", blockId);
|
||||||
|
@ -432,19 +432,19 @@ void playNextBlock() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastBlockId = blockId;
|
lastBlockId = blockId;
|
||||||
IPC->streamFillNeeded[blockId] = false;
|
IPC->streamFillNeeded[blockId] = false;
|
||||||
// DC_FlushAll();
|
// DC_FlushAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (lastBlockId != -1) {
|
if (lastBlockId != -1) {
|
||||||
fillPos = lastBlockId;
|
fillPos = lastBlockId;
|
||||||
/* if (!(REG_KEYINPUT & KEY_R)) {
|
/* if (!(REG_KEYINPUT & KEY_R)) {
|
||||||
|
@ -459,18 +459,18 @@ void stopTrack() {
|
||||||
if (!isPlayingFlag) return;
|
if (!isPlayingFlag) return;
|
||||||
|
|
||||||
DS::std_fclose(file);
|
DS::std_fclose(file);
|
||||||
|
|
||||||
isPlayingFlag = false;
|
isPlayingFlag = false;
|
||||||
|
|
||||||
for (int r = 0; r < BUFFER_SIZE; r++) {
|
for (int r = 0; r < BUFFER_SIZE; r++) {
|
||||||
audioBuffer[r] = 0;
|
audioBuffer[r] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int r= 0; r < waveHeader.fmtExtra; r++) {
|
for (int r= 0; r < waveHeader.fmtExtra; r++) {
|
||||||
decompressionBuffer[r] = 0;
|
decompressionBuffer[r] = 0;
|
||||||
}
|
}
|
||||||
// DS::stopSound(1);
|
// DS::stopSound(1);
|
||||||
|
|
||||||
// free(audioBuffer);
|
// free(audioBuffer);
|
||||||
// free(decompressionBuffer);
|
// free(decompressionBuffer);
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ bool trackExists(int num) {
|
||||||
bool checkCD() {
|
bool checkCD() {
|
||||||
// Need to check whethe CD audio files are present - do this by trying to open Track1.wav.
|
// Need to check whethe CD audio files are present - do this by trying to open Track1.wav.
|
||||||
consolePrintf("Attempted to open cd drive\n");
|
consolePrintf("Attempted to open cd drive\n");
|
||||||
|
|
||||||
if (trackExists(1)) {
|
if (trackExists(1)) {
|
||||||
trackStartsAt2 = false;
|
trackStartsAt2 = false;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _CDAUDIO_H_
|
#ifndef _CDAUDIO_H_
|
||||||
#define _CDAUDIO_H_
|
#define _CDAUDIO_H_
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
//
|
//
|
||||||
// Changelog:
|
// Changelog:
|
||||||
// 0.1: First version
|
// 0.1: First version
|
||||||
// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
|
// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
|
||||||
// Changed some register defines for consistency.
|
// Changed some register defines for consistency.
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
@ -87,7 +87,7 @@ void consoleClear(void);
|
||||||
//
|
//
|
||||||
// Changelog:
|
// Changelog:
|
||||||
// 0.1: First version
|
// 0.1: First version
|
||||||
// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
|
// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
|
||||||
// Changed some register defines for consistency.
|
// Changed some register defines for consistency.
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DSMAIN_H
|
#ifndef _DSMAIN_H
|
||||||
#define _DSMAIN_H
|
#define _DSMAIN_H
|
||||||
|
|
||||||
|
@ -42,98 +42,100 @@ enum controlType {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gameListType {
|
struct gameListType {
|
||||||
char gameId[16];
|
char gameId[16];
|
||||||
controlType control;
|
controlType control;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Pen reading functions
|
// Pen reading functions
|
||||||
void penInit();
|
void penInit();
|
||||||
void penUpdate();
|
void penUpdate();
|
||||||
bool getPenDown();
|
bool getPenDown();
|
||||||
bool getPenHeld();
|
bool getPenHeld();
|
||||||
bool getPenReleased();
|
bool getPenReleased();
|
||||||
int getPenX();
|
int getPenX();
|
||||||
int getPenY();
|
int getPenY();
|
||||||
GLvector getPenPos();
|
GLvector getPenPos();
|
||||||
void consumePenEvents();
|
void consumePenEvents();
|
||||||
|
|
||||||
// Pad reading
|
// Pad reading
|
||||||
int getKeysHeld();
|
int getKeysHeld();
|
||||||
void keysUpdate();
|
void keysUpdate();
|
||||||
int getKeysDown();
|
int getKeysDown();
|
||||||
int getKeysReleased();
|
int getKeysReleased();
|
||||||
void consumeKeys();
|
void consumeKeys();
|
||||||
int leftHandedSwap(int keys);
|
int leftHandedSwap(int keys);
|
||||||
|
|
||||||
// Video
|
// Video
|
||||||
void displayMode8Bit(); // Switch to 8-bit mode5
|
void displayMode8Bit(); // Switch to 8-bit mode5
|
||||||
void displayMode16Bit(); // Switch to 16-bit mode5
|
void displayMode16Bit(); // Switch to 16-bit mode5
|
||||||
|
|
||||||
// Flip double buffer
|
// Flip double buffer
|
||||||
void displayMode16BitFlipBuffer();
|
void displayMode16BitFlipBuffer();
|
||||||
|
|
||||||
// Get address of current back buffer
|
// Get address of current back buffer
|
||||||
u16* get16BitBackBuffer();
|
u16* get16BitBackBuffer();
|
||||||
u16* get8BitBackBuffer();
|
u16* get8BitBackBuffer();
|
||||||
|
s32 get8BitBackBufferStride();
|
||||||
|
u16* getScalerBuffer();
|
||||||
|
|
||||||
void setTalkPos(int x, int y);
|
void setTalkPos(int x, int y);
|
||||||
void setTopScreenTarget(int x, int y);
|
void setTopScreenTarget(int x, int y);
|
||||||
void set200PercentFixedScale(bool on);
|
void set200PercentFixedScale(bool on);
|
||||||
|
|
||||||
// Timers
|
// Timers
|
||||||
void setTimerCallback(OSystem_DS::TimerProc proc, int interval); // Setup a callback function at a regular interval
|
void setTimerCallback(OSystem_DS::TimerProc proc, int interval); // Setup a callback function at a regular interval
|
||||||
int getMillis(); // Return the current runtime in milliseconds
|
int getMillis(); // Return the current runtime in milliseconds
|
||||||
void doTimerCallback(); // Call callback function if required
|
void doTimerCallback(); // Call callback function if required
|
||||||
|
|
||||||
// Sound
|
// Sound
|
||||||
void setSoundProc(OSystem_DS::SoundProc proc, void* param); // Setup a callback function for sound
|
void setSoundProc(OSystem_DS::SoundProc proc, void* param); // Setup a callback function for sound
|
||||||
void doSoundCallback(); // Call function if sound buffers need more data
|
void doSoundCallback(); // Call function if sound buffers need more data
|
||||||
void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound
|
void playSound(const void* data, u32 length, bool loop, bool adpcm = false, int rate = 22050); // Start a sound
|
||||||
void stopSound(int channel);
|
void stopSound(int channel);
|
||||||
int getSoundFrequency();
|
int getSoundFrequency();
|
||||||
|
|
||||||
// Event queue
|
// Event queue
|
||||||
void addEventsToQueue();
|
void addEventsToQueue();
|
||||||
void VBlankHandler();
|
void VBlankHandler();
|
||||||
|
|
||||||
// Sam and Max Stuff
|
// Sam and Max Stuff
|
||||||
void setGameID(int id);
|
void setGameID(int id);
|
||||||
void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY);
|
void setCursorIcon(const u8* icon, uint w, uint h, byte keycolor, int hotspotX, int hotspotY);
|
||||||
void setShowCursor(bool enable);
|
void setShowCursor(bool enable);
|
||||||
void setMouseCursorVisible(bool visible);
|
void setMouseCursorVisible(bool visible);
|
||||||
|
|
||||||
// Shake
|
// Shake
|
||||||
void setShakePos(int shakePos);
|
void setShakePos(int shakePos);
|
||||||
|
|
||||||
// Reports
|
// Reports
|
||||||
void memoryReport();
|
void memoryReport();
|
||||||
|
|
||||||
// GBAMP
|
// GBAMP
|
||||||
bool isGBAMPAvailable();
|
bool isGBAMPAvailable();
|
||||||
|
|
||||||
// Sleep (I'd like some of that right now)
|
// Sleep (I'd like some of that right now)
|
||||||
void checkSleepMode();
|
void checkSleepMode();
|
||||||
|
|
||||||
// Virtual keyboard
|
// Virtual keyboard
|
||||||
void setKeyboardIcon(bool enable);
|
void setKeyboardIcon(bool enable);
|
||||||
bool getKeyboardIcon();
|
bool getKeyboardIcon();
|
||||||
void setKeyboardEnable(bool en);
|
void setKeyboardEnable(bool en);
|
||||||
bool getKeyboardEnable();
|
bool getKeyboardEnable();
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
void setLeftHanded(bool enable);
|
void setLeftHanded(bool enable);
|
||||||
void setTouchXOffset(int x);
|
void setTouchXOffset(int x);
|
||||||
void setTouchYOffset(int y);
|
void setTouchYOffset(int y);
|
||||||
void setUnscaledMode(bool enable);
|
void setUnscaledMode(bool enable);
|
||||||
void setSnapToBorder(bool enable);
|
void setSnapToBorder(bool enable);
|
||||||
void setIndyFightState(bool st);
|
void setIndyFightState(bool st);
|
||||||
bool getIndyFightState();
|
bool getIndyFightState();
|
||||||
bool isCpuScalerEnabled();
|
bool isCpuScalerEnabled();
|
||||||
void setCpuScalerEnable(bool enable);
|
void setCpuScalerEnable(bool enable);
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
bool getIsDisplayMode8Bit();
|
bool getIsDisplayMode8Bit();
|
||||||
void setGameSize(int width, int height);
|
void setGameSize(int width, int height);
|
||||||
int getGameWidth();
|
int getGameWidth();
|
||||||
int getGameHeight();
|
int getGameHeight();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dsoptions.h"
|
#include "dsoptions.h"
|
||||||
#include "dsmain.h"
|
#include "dsmain.h"
|
||||||
#include "gui/dialog.h"
|
#include "gui/dialog.h"
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
#include "osystem_ds.h"
|
#include "osystem_ds.h"
|
||||||
#include "engines/scumm/scumm.h"
|
#include "engines/scumm/scumm.h"
|
||||||
#include "touchkeyboard.h"
|
#include "touchkeyboard.h"
|
||||||
|
#include "gui/PopUpWidget.h"
|
||||||
|
|
||||||
#define ALLOW_CPU_SCALER
|
#define ALLOW_CPU_SCALER
|
||||||
|
|
||||||
|
@ -40,28 +41,39 @@ namespace Scumm {
|
||||||
|
|
||||||
namespace DS {
|
namespace DS {
|
||||||
|
|
||||||
DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
|
DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(5, 0, 320 - 5, 230 - 20) {
|
||||||
addButton(this, 10, 175, "Close", GUI::kCloseCmd, 'C');
|
addButton(this, 10, 175, "Close", GUI::kCloseCmd, 'C');
|
||||||
|
|
||||||
|
_radioButtonMode = false;
|
||||||
|
|
||||||
#ifdef DS_SCUMM_BUILD
|
#ifdef DS_SCUMM_BUILD
|
||||||
if (!DS::isGBAMPAvailable()) {
|
if (!DS::isGBAMPAvailable()) {
|
||||||
// addButton(this, 100, 140, "Delete Save", 'dels', 'D');
|
// addButton(this, 100, 140, "Delete Save", 'dels', 'D');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
new GUI::StaticTextWidget(this, 80, 10, 130, 15, "ScummVM DS Options", GUI::kTextAlignCenter);
|
new GUI::StaticTextWidget(this, 90, 10, 130, 15, "ScummVM DS Options", GUI::kTextAlignCenter);
|
||||||
|
|
||||||
_leftHandedCheckbox = new GUI::CheckboxWidget(this, 20, 25, 200, 20, "Left handed mode", 0, 'L');
|
_leftHandedCheckbox = new GUI::CheckboxWidget(this, 5, 70, 130, 20, "Left handed mode", 0, 'L');
|
||||||
_indyFightCheckbox = new GUI::CheckboxWidget(this, 20, 40, 200, 20, "Indy fighting controls", 0, 'I');
|
_indyFightCheckbox = new GUI::CheckboxWidget(this, 5, 40, 200, 20, "Indy fighting controls", 0, 'I');
|
||||||
_unscaledCheckbox = new GUI::CheckboxWidget(this, 20, 55, 200, 20, "Unscaled main screen", 0, 'S');
|
_twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 5, 55, 230, 20, "Zoomed screen at fixed 200% zoom", 0, 'T');
|
||||||
_twoHundredPercentCheckbox = new GUI::CheckboxWidget(this, 20, 70, 230, 20, "Zoomed screen at fixed 200% zoom", 0, 'T');
|
_highQualityAudioCheckbox = new GUI::CheckboxWidget(this, 5, 25, 250, 20, "High quality audio (slower) (reboot)", 0, 'T');
|
||||||
_highQualityAudioCheckbox = new GUI::CheckboxWidget(this, 20, 85, 250, 20, "High quality audio (slower) (reboot)", 0, 'T');
|
_disablePowerOff = new GUI::CheckboxWidget(this, 5, 85, 130, 20, "Disable power off", 0, 'T');
|
||||||
_disablePowerOff = new GUI::CheckboxWidget(this, 20, 100, 250, 20, "Disable power off on quit", 0, 'T');
|
_showCursorCheckbox = new GUI::CheckboxWidget(this, 5, 100, 130, 20, "Show mouse cursor", 0, 'T');
|
||||||
_showCursorCheckbox = new GUI::CheckboxWidget(this, 20, 115, 130, 20, "Show mouse cursor", 0, 'T');
|
|
||||||
#ifdef ALLOW_CPU_SCALER
|
//#ifdef ALLOW_CPU_SCALER
|
||||||
_cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T');
|
// _cpuScaler = new GUI::CheckboxWidget(this, 160, 115, 90, 20, "CPU scaler", 0, 'T');
|
||||||
#endif
|
//#endif
|
||||||
_snapToBorderCheckbox = new GUI::CheckboxWidget(this, 20, 130, 250, 20, "Snap to border", 0, 'T');
|
|
||||||
|
new GUI::StaticTextWidget(this, 180, 70, 130, 15, "Main screen:", GUI::kTextAlignLeft);
|
||||||
|
|
||||||
|
_hardScaler = new GUI::CheckboxWidget(this, 140, 85, 170, 20, "Hardware scale (fast)", 0x10000001, 'T');
|
||||||
|
_cpuScaler = new GUI::CheckboxWidget(this, 140, 100, 170, 20, "Software scale (quality)", 0x10000002, 'S');
|
||||||
|
_unscaledCheckbox = new GUI::CheckboxWidget(this, 140, 115, 170, 20, "Unscaled", 0x10000003, 'S');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
_snapToBorderCheckbox = new GUI::CheckboxWidget(this, 5, 115, 120, 20, "Snap to border", 0, 'T');
|
||||||
|
|
||||||
new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
|
new GUI::StaticTextWidget(this, 20, 145, 110, 15, "Touch X Offset", GUI::kTextAlignLeft);
|
||||||
_touchX = new GUI::SliderWidget(this, 130, 145, 130, 12, 1);
|
_touchX = new GUI::SliderWidget(this, 130, 145, 130, 12, 1);
|
||||||
|
@ -153,6 +165,11 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
|
||||||
_touchY->setValue(0);
|
_touchY->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_cpuScaler->getState() && !_unscaledCheckbox->getState()) {
|
||||||
|
_hardScaler->setState(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
_radioButtonMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSOptionsDialog::~DSOptionsDialog() {
|
DSOptionsDialog::~DSOptionsDialog() {
|
||||||
|
@ -177,16 +194,49 @@ void DSOptionsDialog::updateConfigManager() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
|
void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) {
|
||||||
|
|
||||||
|
static bool guard = false;
|
||||||
|
|
||||||
|
if ((!guard) && (_radioButtonMode))
|
||||||
|
{
|
||||||
|
guard = true;
|
||||||
|
|
||||||
|
if ((cmd & 0xFF000000) == 0x10000000)
|
||||||
|
{
|
||||||
|
_cpuScaler->setState(false);
|
||||||
|
_hardScaler->setState(false);
|
||||||
|
_unscaledCheckbox->setState(false);
|
||||||
|
|
||||||
|
if ((sender == _cpuScaler) && (cmd == 0x10000002))
|
||||||
|
{
|
||||||
|
_cpuScaler->setState(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sender == _hardScaler) && (cmd == 0x10000001))
|
||||||
|
{
|
||||||
|
_hardScaler->setState(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sender == _unscaledCheckbox) && (cmd == 0x10000003))
|
||||||
|
{
|
||||||
|
_unscaledCheckbox->setState(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
guard = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (cmd == GUI::kCloseCmd) {
|
if (cmd == GUI::kCloseCmd) {
|
||||||
updateConfigManager();
|
updateConfigManager();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DS_SCUMM_BUILD
|
#ifdef DS_SCUMM_BUILD
|
||||||
/* if (cmd == 'dels') {
|
/* if (cmd == 'dels') {
|
||||||
_delDialog->setList(Scumm::generateSavegameList(Scumm::g_scumm, false));
|
_delDialog->setList(Scumm::generateSavegameList(Scumm::g_scumm, false));
|
||||||
_delDialog->handleCommand(NULL, GUI::kListSelectionChangedCmd, 0);
|
_delDialog->handleCommand(NULL, GUI::kListSelectionChangedCmd, 0);
|
||||||
|
|
||||||
Common::Event event;
|
Common::Event event;
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
event.type = Common::EVENT_KEYDOWN;
|
||||||
event.kbd.ascii = 0;
|
event.kbd.ascii = 0;
|
||||||
|
@ -195,9 +245,9 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
|
||||||
|
|
||||||
event.type = Common::EVENT_KEYUP;
|
event.type = Common::EVENT_KEYUP;
|
||||||
OSystem_DS::instance()->addEvent(event);
|
OSystem_DS::instance()->addEvent(event);
|
||||||
|
|
||||||
int idx = _delDialog->runModal();
|
int idx = _delDialog->runModal();
|
||||||
|
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
char name[256];
|
char name[256];
|
||||||
Scumm::g_scumm->makeSavegameName(name, idx, false);
|
Scumm::g_scumm->makeSavegameName(name, idx, false);
|
||||||
|
@ -205,10 +255,10 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
|
||||||
((DSSaveFileManager *) (OSystem_DS::instance()->getSavefileManager()))->deleteFile(name);
|
((DSSaveFileManager *) (OSystem_DS::instance()->getSavefileManager()))->deleteFile(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,11 +270,11 @@ void togglePause() {
|
||||||
OSystem_DS* system = OSystem_DS::instance();
|
OSystem_DS* system = OSystem_DS::instance();
|
||||||
|
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
event.type = Common::EVENT_KEYDOWN;
|
||||||
event.kbd.keycode = Common::KEYCODE_p;
|
event.kbd.keycode = Common::KEYCODE_p;
|
||||||
event.kbd.ascii = 'p';
|
event.kbd.ascii = 'p';
|
||||||
event.kbd.flags = 0;
|
event.kbd.flags = 0;
|
||||||
system->addEvent(event);
|
system->addEvent(event);
|
||||||
|
|
||||||
event.type = Common::EVENT_KEYUP;
|
event.type = Common::EVENT_KEYUP;
|
||||||
system->addEvent(event);
|
system->addEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -235,14 +285,12 @@ void showOptionsDialog() {
|
||||||
togglePause();
|
togglePause();
|
||||||
|
|
||||||
DS::displayMode16Bit();
|
DS::displayMode16Bit();
|
||||||
|
|
||||||
|
|
||||||
DSOptionsDialog* d = new DSOptionsDialog();
|
DSOptionsDialog* d = new DSOptionsDialog();
|
||||||
d->runModal();
|
d->runModal();
|
||||||
consolePrintf("deleting dialog\n");
|
|
||||||
delete d;
|
delete d;
|
||||||
|
|
||||||
consolePrintf("going to 8 bit\n");
|
|
||||||
DS::displayMode8Bit();
|
DS::displayMode8Bit();
|
||||||
|
|
||||||
togglePause();
|
togglePause();
|
||||||
|
@ -303,7 +351,8 @@ void setOptions() {
|
||||||
} else {
|
} else {
|
||||||
DS::setCpuScalerEnable(false);
|
DS::setCpuScalerEnable(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DSOPTIONS_H_
|
#ifndef _DSOPTIONS_H_
|
||||||
#define _DSOPTIONS_H_
|
#define _DSOPTIONS_H_
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class DSOptionsDialog : public GUI::Dialog {
|
||||||
public:
|
public:
|
||||||
DSOptionsDialog();
|
DSOptionsDialog();
|
||||||
~DSOptionsDialog();
|
~DSOptionsDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
|
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
|
||||||
void togglePause();
|
void togglePause();
|
||||||
|
@ -53,14 +53,18 @@ protected:
|
||||||
GUI::CheckboxWidget* _indyFightCheckbox;
|
GUI::CheckboxWidget* _indyFightCheckbox;
|
||||||
GUI::CheckboxWidget* _highQualityAudioCheckbox;
|
GUI::CheckboxWidget* _highQualityAudioCheckbox;
|
||||||
GUI::CheckboxWidget* _disablePowerOff;
|
GUI::CheckboxWidget* _disablePowerOff;
|
||||||
GUI::CheckboxWidget* _cpuScaler;
|
|
||||||
GUI::CheckboxWidget* _showCursorCheckbox;
|
GUI::CheckboxWidget* _showCursorCheckbox;
|
||||||
GUI::CheckboxWidget* _snapToBorderCheckbox;
|
GUI::CheckboxWidget* _snapToBorderCheckbox;
|
||||||
|
|
||||||
|
GUI::CheckboxWidget* _hardScaler;
|
||||||
|
GUI::CheckboxWidget* _cpuScaler;
|
||||||
|
|
||||||
#ifdef DS_SCUMM_BUILD
|
#ifdef DS_SCUMM_BUILD
|
||||||
Scumm::SaveLoadChooser* _delDialog;
|
Scumm::SaveLoadChooser* _delDialog;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool _radioButtonMode;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void showOptionsDialog();
|
extern void showOptionsDialog();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
uniformed io-interface to work with Chishm's FAT library
|
uniformed io-interface to work with Chishm's FAT library
|
||||||
|
|
||||||
Written by MightyMax
|
Written by MightyMax
|
||||||
|
|
||||||
Modified by Chishm:
|
Modified by Chishm:
|
||||||
2005-11-06
|
2005-11-06
|
||||||
* Added WAIT_CR modifications for NDS
|
* Added WAIT_CR modifications for NDS
|
||||||
|
@ -87,7 +87,7 @@ LPIO_INTERFACE active_interface = 0;
|
||||||
|
|
||||||
Disc Cache functions
|
Disc Cache functions
|
||||||
2006-02-03:
|
2006-02-03:
|
||||||
Added by www.neoflash.com
|
Added by www.neoflash.com
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int discDetect = 0;
|
int discDetect = 0;
|
||||||
|
@ -99,7 +99,7 @@ int dldiFound = FALSE;
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define CACHE_FREE 0xFFFFFFFF
|
#define CACHE_FREE 0xFFFFFFFF
|
||||||
|
|
||||||
static u8 cacheBuffer[ DISC_CACHE_COUNT * 512 ];
|
static u8 cacheBuffer[ DISC_CACHE_COUNT * 512 ];
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
@ -112,20 +112,20 @@ FATDevice currentDevice;
|
||||||
|
|
||||||
static u32 disc_CacheFind(u32 sector) {
|
static u32 disc_CacheFind(u32 sector) {
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
for( i = 0; i < DISC_CACHE_COUNT; i++ ) {
|
for( i = 0; i < DISC_CACHE_COUNT; i++ ) {
|
||||||
if( cache[ i ].sector == sector )
|
if( cache[ i ].sector == sector )
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CACHE_FREE;
|
return CACHE_FREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 disc_CacheFindFree(void) {
|
static u32 disc_CacheFindFree(void) {
|
||||||
|
|
||||||
u32 i = 0, j;
|
u32 i = 0, j;
|
||||||
u32 count = -1;
|
u32 count = -1;
|
||||||
|
|
||||||
for( j = 0; j < DISC_CACHE_COUNT; j++ ) {
|
for( j = 0; j < DISC_CACHE_COUNT; j++ ) {
|
||||||
|
|
||||||
if( cache[ j ].sector == CACHE_FREE ) {
|
if( cache[ j ].sector == CACHE_FREE ) {
|
||||||
|
@ -142,7 +142,7 @@ static u32 disc_CacheFindFree(void) {
|
||||||
if( cache[ i ].sector != CACHE_FREE && cache[i].dirty != 0 ) {
|
if( cache[ i ].sector != CACHE_FREE && cache[i].dirty != 0 ) {
|
||||||
|
|
||||||
active_interface->fn_WriteSectors( cache[ i ].sector, 1, &cacheBuffer[ i * 512 ] );
|
active_interface->fn_WriteSectors( cache[ i ].sector, 1, &cacheBuffer[ i * 512 ] );
|
||||||
/* todo: handle write error here
|
/* todo: handle write error here
|
||||||
|
|
||||||
cache[ i ].sector = CACHE_FREE;
|
cache[ i ].sector = CACHE_FREE;
|
||||||
cache[ i ].dirty = 0;
|
cache[ i ].dirty = 0;
|
||||||
|
@ -431,7 +431,7 @@ bool disc_setDsSlotInterface (void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool disc_Init(void)
|
bool disc_Init(void)
|
||||||
{
|
{
|
||||||
#ifdef DISC_CACHE
|
#ifdef DISC_CACHE
|
||||||
disc_CacheInit();
|
disc_CacheInit();
|
||||||
|
@ -455,15 +455,15 @@ bool disc_Init(void)
|
||||||
// could not find a working IO Interface
|
// could not find a working IO Interface
|
||||||
active_interface = 0 ;
|
active_interface = 0 ;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disc_IsInserted(void)
|
bool disc_IsInserted(void)
|
||||||
{
|
{
|
||||||
if (active_interface) return active_interface->fn_IsInserted() ;
|
if (active_interface) return active_interface->fn_IsInserted() ;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
|
bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
#ifdef DISC_CACHE
|
#ifdef DISC_CACHE
|
||||||
u8 *p=(u8*)buffer;
|
u8 *p=(u8*)buffer;
|
||||||
|
@ -480,9 +480,9 @@ bool disc_ReadSectors(u32 sector, u8 numSecs, void* buffer)
|
||||||
if (active_interface) return active_interface->fn_ReadSectors(sector,numSecs,buffer) ;
|
if (active_interface) return active_interface->fn_ReadSectors(sector,numSecs,buffer) ;
|
||||||
return false ;
|
return false ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
|
bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
/*#ifdef DISC_CACHE
|
/*#ifdef DISC_CACHE
|
||||||
u8 *p=(u8*)buffer;
|
u8 *p=(u8*)buffer;
|
||||||
|
@ -499,18 +499,46 @@ bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
|
||||||
#ifdef DISC_CACHE
|
#ifdef DISC_CACHE
|
||||||
disc_CacheInit();
|
disc_CacheInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MISALIGNMENT_BODGE
|
||||||
|
|
||||||
|
#ifdef MISALIGNMENT_BODGE
|
||||||
|
// This bodge works around problems with some card reader drivers which require data to be
|
||||||
|
// aligned to 2- or 4-byte boundaries it varies which one they require. This bodge sorts
|
||||||
|
// it but also reduces write speed as it doesn't use the multi-sector write capability any
|
||||||
|
// more. A better fix will be written for a future version.
|
||||||
|
|
||||||
|
if (active_interface) {
|
||||||
|
u8 sectorBuffer[512];
|
||||||
|
int r;
|
||||||
|
|
||||||
|
for (r = 0; r < numSecs; r++) {
|
||||||
|
memcpy(sectorBuffer, &buffer[r * 512], 512);
|
||||||
|
|
||||||
|
if (!active_interface->fn_WriteSectors(sector + r, 1, sectorBuffer))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
if (active_interface) return active_interface->fn_WriteSectors(sector,numSecs,buffer) ;
|
if (active_interface) return active_interface->fn_WriteSectors(sector,numSecs,buffer) ;
|
||||||
return false ;
|
return false ;
|
||||||
|
#endif
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disc_ClearStatus(void)
|
bool disc_ClearStatus(void)
|
||||||
{
|
{
|
||||||
if (active_interface) return active_interface->fn_ClearStatus() ;
|
if (active_interface) return active_interface->fn_ClearStatus() ;
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool disc_Shutdown(void)
|
bool disc_Shutdown(void)
|
||||||
{
|
{
|
||||||
#ifdef DISC_CACHE
|
#ifdef DISC_CACHE
|
||||||
disc_CacheFlush();
|
disc_CacheFlush();
|
||||||
|
@ -518,7 +546,7 @@ bool disc_Shutdown(void)
|
||||||
if (active_interface) active_interface->fn_Shutdown() ;
|
if (active_interface) active_interface->fn_Shutdown() ;
|
||||||
active_interface = 0 ;
|
active_interface = 0 ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 disc_HostType (void)
|
u32 disc_HostType (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
// Use DMA to read the card, remove this line to use normal reads/writes
|
// Use DMA to read the card, remove this line to use normal reads/writes
|
||||||
// #define _CF_USE_DMA
|
// #define _CF_USE_DMA
|
||||||
|
|
||||||
// Allow buffers not aligned to 16 bits when reading files.
|
// Allow buffers not aligned to 16 bits when reading files.
|
||||||
// Note that this will slow down access speed, so only use if you have to.
|
// Note that this will slow down access speed, so only use if you have to.
|
||||||
// It is also incompatible with DMA
|
// It is also incompatible with DMA
|
||||||
#define _CF_ALLOW_UNALIGNED
|
#define _CF_ALLOW_UNALIGNED
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
// This allows the code to build on an earlier version of libnds, before the register was renamed
|
// This allows the code to build on an earlier version of libnds, before the register was renamed
|
||||||
#ifndef REG_EXMEMCNT
|
#ifndef REG_EXMEMCNT
|
||||||
#define REG_EXMEMCNT REG_EXEMEMCNT
|
#define REG_EXMEMCNT REG_EXEMEMCNT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef REG_EXEMEMCNT
|
#ifndef REG_EXEMEMCNT
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disable NDS specific hardware and features if running on a GBA
|
// Disable NDS specific hardware and features if running on a GBA
|
||||||
#ifndef NDS
|
#ifndef NDS
|
||||||
#undef SUPPORT_NMMC
|
#undef SUPPORT_NMMC
|
||||||
#undef DISC_CACHE
|
#undef DISC_CACHE
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
// Maximum number of files open at once
|
// Maximum number of files open at once
|
||||||
// Increase this to open more files, decrease to save memory
|
// Increase this to open more files, decrease to save memory
|
||||||
#define MAX_FILES_OPEN 4
|
#define MAX_FILES_OPEN 16
|
||||||
|
|
||||||
// Allow file writing
|
// Allow file writing
|
||||||
// Disable this to remove file writing support
|
// Disable this to remove file writing support
|
||||||
|
@ -147,7 +147,7 @@ bool FAT_GetAlias (char* alias);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------
|
/*-----------------------------------------------------------------
|
||||||
FAT_GetLongFilename
|
FAT_GetLongFilename
|
||||||
Get the long name of the last file or directory retrived with
|
Get the long name of the last file or directory retrived with
|
||||||
GetDirEntry. Also works for FindFirstFile and FindNextFile
|
GetDirEntry. Also works for FindFirstFile and FindNextFile
|
||||||
char* filename: OUT will be filled with the filename, should be at
|
char* filename: OUT will be filled with the filename, should be at
|
||||||
least 256 bytes long
|
least 256 bytes long
|
||||||
|
@ -210,7 +210,7 @@ FAT_FindNextFile
|
||||||
Gets the name of the next directory entry
|
Gets the name of the next directory entry
|
||||||
(can be a file or subdirectory)
|
(can be a file or subdirectory)
|
||||||
char* filename: OUT filename, must be at least 13 chars long
|
char* filename: OUT filename, must be at least 13 chars long
|
||||||
FILE_TYPE return: OUT returns FT_NONE if failed,
|
FILE_TYPE return: OUT returns FT_NONE if failed,
|
||||||
FT_FILE if it found a file and FT_DIR if it found a directory
|
FT_FILE if it found a file and FT_DIR if it found a directory
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
FILE_TYPE FAT_FindNextFile (char* filename);
|
FILE_TYPE FAT_FindNextFile (char* filename);
|
||||||
|
@ -220,7 +220,7 @@ FAT_FindFirstFile
|
||||||
Gets the name of the first directory entry and resets the count
|
Gets the name of the first directory entry and resets the count
|
||||||
(can be a file or subdirectory)
|
(can be a file or subdirectory)
|
||||||
char* filename: OUT filename, must be at least 13 chars long
|
char* filename: OUT filename, must be at least 13 chars long
|
||||||
FILE_TYPE return: OUT returns FT_NONE if failed,
|
FILE_TYPE return: OUT returns FT_NONE if failed,
|
||||||
FT_FILE if it found a file and FT_DIR if it found a directory
|
FT_FILE if it found a file and FT_DIR if it found a directory
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
FILE_TYPE FAT_FindFirstFile (char* filename);
|
FILE_TYPE FAT_FindFirstFile (char* filename);
|
||||||
|
@ -230,7 +230,7 @@ FAT_FindFirstFileLFN
|
||||||
Gets the long file name of the first directory entry and resets
|
Gets the long file name of the first directory entry and resets
|
||||||
the count (can be a file or subdirectory)
|
the count (can be a file or subdirectory)
|
||||||
char* lfn: OUT long file name, must be at least 256 chars long
|
char* lfn: OUT long file name, must be at least 256 chars long
|
||||||
FILE_TYPE return: OUT returns FT_NONE if failed,
|
FILE_TYPE return: OUT returns FT_NONE if failed,
|
||||||
FT_FILE if it found a file and FT_DIR if it found a directory
|
FT_FILE if it found a file and FT_DIR if it found a directory
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
FILE_TYPE FAT_FindFirstFileLFN(char* lfn);
|
FILE_TYPE FAT_FindFirstFileLFN(char* lfn);
|
||||||
|
@ -240,16 +240,16 @@ FAT_FindNextFileLFN
|
||||||
Gets the long file name of the next directory entry
|
Gets the long file name of the next directory entry
|
||||||
(can be a file or subdirectory)
|
(can be a file or subdirectory)
|
||||||
char* lfn: OUT long file name, must be at least 256 chars long
|
char* lfn: OUT long file name, must be at least 256 chars long
|
||||||
FILE_TYPE return: OUT returns FT_NONE if failed,
|
FILE_TYPE return: OUT returns FT_NONE if failed,
|
||||||
FT_FILE if it found a file and FT_DIR if it found a directory
|
FT_FILE if it found a file and FT_DIR if it found a directory
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
FILE_TYPE FAT_FindNextFileLFN(char* lfn);
|
FILE_TYPE FAT_FindNextFileLFN(char* lfn);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------
|
/*-----------------------------------------------------------------
|
||||||
FAT_FileExists
|
FAT_FileExists
|
||||||
Returns the type of file
|
Returns the type of file
|
||||||
char* filename: IN filename of the file to look for
|
char* filename: IN filename of the file to look for
|
||||||
FILE_TYPE return: OUT returns FT_NONE if there is now file with
|
FILE_TYPE return: OUT returns FT_NONE if there is now file with
|
||||||
that name, FT_FILE if it is a file and FT_DIR if it is a directory
|
that name, FT_FILE if it is a file and FT_DIR if it is a directory
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
FILE_TYPE FAT_FileExists (const char* filename);
|
FILE_TYPE FAT_FileExists (const char* filename);
|
||||||
|
@ -269,7 +269,7 @@ u32 FAT_GetFileSystemTotalSize (void);
|
||||||
/*-----------------------------------------------------------------
|
/*-----------------------------------------------------------------
|
||||||
FAT_chdir
|
FAT_chdir
|
||||||
Changes the current working directory
|
Changes the current working directory
|
||||||
const char* path: IN null terminated string of directory separated by
|
const char* path: IN null terminated string of directory separated by
|
||||||
forward slashes, / is root
|
forward slashes, / is root
|
||||||
bool return: OUT returns true if successful
|
bool return: OUT returns true if successful
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
|
@ -282,12 +282,12 @@ bool FAT_chdir (const char* path);
|
||||||
/*-----------------------------------------------------------------
|
/*-----------------------------------------------------------------
|
||||||
FAT_fopen(filename, mode)
|
FAT_fopen(filename, mode)
|
||||||
Opens a file
|
Opens a file
|
||||||
const char* path: IN null terminated string of filename and path
|
const char* path: IN null terminated string of filename and path
|
||||||
separated by forward slashes, / is root
|
separated by forward slashes, / is root
|
||||||
const char* mode: IN mode to open file in
|
const char* mode: IN mode to open file in
|
||||||
Supported modes: "r", "r+", "w", "w+", "a", "a+", don't use
|
Supported modes: "r", "r+", "w", "w+", "a", "a+", don't use
|
||||||
"b" or "t" in any mode, as all files are openned in binary mode
|
"b" or "t" in any mode, as all files are openned in binary mode
|
||||||
FAT_FILE* return: OUT handle to open file, returns -1 if the file
|
FAT_FILE* return: OUT handle to open file, returns -1 if the file
|
||||||
couldn't be openned
|
couldn't be openned
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
FAT_FILE* FAT_fopen(const char* path, const char* mode);
|
FAT_FILE* FAT_fopen(const char* path, const char* mode);
|
||||||
|
@ -338,7 +338,7 @@ u32 FAT_fread (void* buffer, u32 size, u32 count, FAT_FILE* file);
|
||||||
FAT_fwrite(buffer, size, count, file)
|
FAT_fwrite(buffer, size, count, file)
|
||||||
Writes size * count bytes into file from buffer, starting
|
Writes size * count bytes into file from buffer, starting
|
||||||
from current position. It then sets the current position to the
|
from current position. It then sets the current position to the
|
||||||
byte after the last byte written. If the file was openned in
|
byte after the last byte written. If the file was openned in
|
||||||
append mode it always writes to the end of the file.
|
append mode it always writes to the end of the file.
|
||||||
const void* buffer IN: Pointer to buffer containing data. Should be
|
const void* buffer IN: Pointer to buffer containing data. Should be
|
||||||
at least as big as the number of bytes to be written.
|
at least as big as the number of bytes to be written.
|
||||||
|
@ -371,7 +371,7 @@ int FAT_remove (const char* path);
|
||||||
#ifdef CAN_WRITE_TO_DISC
|
#ifdef CAN_WRITE_TO_DISC
|
||||||
/*-----------------------------------------------------------------
|
/*-----------------------------------------------------------------
|
||||||
FAT_mkdir (path)
|
FAT_mkdir (path)
|
||||||
Makes a new directory, so long as no other directory or file has
|
Makes a new directory, so long as no other directory or file has
|
||||||
the same name.
|
the same name.
|
||||||
const char* path IN: Path and filename of directory to make
|
const char* path IN: Path and filename of directory to make
|
||||||
int return OUT: zero if successful, non-zero if not
|
int return OUT: zero if successful, non-zero if not
|
||||||
|
@ -403,9 +403,9 @@ FAT_fgets (char *tgtBuffer, int num, FAT_FILE* file)
|
||||||
Gets a up to num bytes from file, stopping at the first
|
Gets a up to num bytes from file, stopping at the first
|
||||||
newline.
|
newline.
|
||||||
|
|
||||||
CAUTION: does not do strictly streaming. I.e. it's
|
CAUTION: does not do strictly streaming. I.e. it's
|
||||||
reading more then needed bytes and seeking back.
|
reading more then needed bytes and seeking back.
|
||||||
shouldn't matter for random access
|
shouldn't matter for random access
|
||||||
|
|
||||||
char *tgtBuffer OUT: buffer to write to
|
char *tgtBuffer OUT: buffer to write to
|
||||||
int num IN: size of target buffer
|
int num IN: size of target buffer
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
io_dldi.h
|
io_dldi.h
|
||||||
|
|
||||||
Reserved space for new drivers
|
Reserved space for new drivers
|
||||||
|
|
||||||
This software is completely free. No warranty is provided.
|
This software is completely free. No warranty is provided.
|
||||||
If you use it, please give me credit and email me about your
|
If you use it, please give me credit and email me about your
|
||||||
project at chishm@hotmail.com
|
project at chishm@hotmail.com
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
.byte 0x01 @ Version number
|
.byte 0x01 @ Version number
|
||||||
.byte 0x0F @32KiB @ Log [base-2] of the size of this driver in bytes.
|
.byte 0x0F @32KiB @ Log [base-2] of the size of this driver in bytes.
|
||||||
.byte 0x00 @ Sections to fix
|
.byte 0x00 @ Sections to fix
|
||||||
.byte 0x0F @32KiB @ Log [base-2] of the allocated space in bytes.
|
.byte 0x0F @32KiB @ Log [base-2] of the allocated space in bytes.
|
||||||
|
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
@ Text identifier - can be anything up to 47 chars + terminating null -- 16 bytes
|
@ Text identifier - can be anything up to 47 chars + terminating null -- 16 bytes
|
||||||
.align 4
|
.align 4
|
||||||
|
@ -42,13 +42,13 @@ _dldi_driver_name:
|
||||||
_io_dldi:
|
_io_dldi:
|
||||||
.ascii "DLDI" @ ioType
|
.ascii "DLDI" @ ioType
|
||||||
.word 0x00000000 @ Features
|
.word 0x00000000 @ Features
|
||||||
.word _DLDI_startup @
|
.word _DLDI_startup @
|
||||||
.word _DLDI_isInserted @
|
.word _DLDI_isInserted @
|
||||||
.word _DLDI_readSectors @ Function pointers to standard device driver functions
|
.word _DLDI_readSectors @ Function pointers to standard device driver functions
|
||||||
.word _DLDI_writeSectors @
|
.word _DLDI_writeSectors @
|
||||||
.word _DLDI_clearStatus @
|
.word _DLDI_clearStatus @
|
||||||
.word _DLDI_shutdown @
|
.word _DLDI_shutdown @
|
||||||
|
|
||||||
@---------------------------------------------------------------------------------
|
@---------------------------------------------------------------------------------
|
||||||
|
|
||||||
_DLDI_startup:
|
_DLDI_startup:
|
||||||
|
|
|
@ -47,7 +47,7 @@ See gba_nds_fat.txt for help and license details.
|
||||||
// ID of Samsung K9K1G NAND flash chip
|
// ID of Samsung K9K1G NAND flash chip
|
||||||
#define EFA2_NAND_ID 0xEC79A5C0
|
#define EFA2_NAND_ID 0xEC79A5C0
|
||||||
|
|
||||||
// first sector of udisk
|
// first sector of udisk
|
||||||
#define EFA2_UDSK_START 0x40
|
#define EFA2_UDSK_START 0x40
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -101,7 +101,7 @@ void efa2_nand_lock(void) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set NAND Flash chip enable and write protection bits ?
|
// Set NAND Flash chip enable and write protection bits ?
|
||||||
//
|
//
|
||||||
// val | ~CE | ~WP |
|
// val | ~CE | ~WP |
|
||||||
// -----+-----+-----+
|
// -----+-----+-----+
|
||||||
// 0 | 0 | 0 |
|
// 0 | 0 | 0 |
|
||||||
|
@ -125,7 +125,7 @@ inline void efa2_nand_reset(void) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read out NAND ID information, could be used for card detection
|
// Read out NAND ID information, could be used for card detection
|
||||||
//
|
//
|
||||||
// | EFA2 1GBit |
|
// | EFA2 1GBit |
|
||||||
// ------------------+------------+
|
// ------------------+------------+
|
||||||
// maker code | 0xEC |
|
// maker code | 0xEC |
|
||||||
|
@ -166,7 +166,7 @@ EFA2_ClearStatus
|
||||||
Reads and checks NAND status information
|
Reads and checks NAND status information
|
||||||
bool return OUT: true if NAND is idle
|
bool return OUT: true if NAND is idle
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool EFA2_ClearStatus (void)
|
bool EFA2_ClearStatus (void)
|
||||||
{
|
{
|
||||||
// tbd: currently there is no write support, so always return
|
// tbd: currently there is no write support, so always return
|
||||||
// true, there is no possibility for pending operations
|
// true, there is no possibility for pending operations
|
||||||
|
@ -178,7 +178,7 @@ EFA2_IsInserted
|
||||||
Checks to see if the NAND chip used by the EFA2 is present
|
Checks to see if the NAND chip used by the EFA2 is present
|
||||||
bool return OUT: true if the correct NAND chip is found
|
bool return OUT: true if the correct NAND chip is found
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool EFA2_IsInserted (void)
|
bool EFA2_IsInserted (void)
|
||||||
{
|
{
|
||||||
EFA2_ClearStatus();
|
EFA2_ClearStatus();
|
||||||
return (efa2_nand_id() == EFA2_NAND_ID);
|
return (efa2_nand_id() == EFA2_NAND_ID);
|
||||||
|
@ -223,7 +223,7 @@ bool EFA2_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
efa2_nand_reset();
|
efa2_nand_reset();
|
||||||
|
|
||||||
// set NAND to READ1 operation mode and transfer page address
|
// set NAND to READ1 operation mode and transfer page address
|
||||||
REG_EFA2_NAND_CMD = 0x00; // write READ1 command
|
REG_EFA2_NAND_CMD = 0x00; // write READ1 command
|
||||||
REG_EFA2_NAND_WR = 0x00; // write address [7:0]
|
REG_EFA2_NAND_WR = 0x00; // write address [7:0]
|
||||||
REG_EFA2_NAND_WR = (page ) & 0xff; // write address [15:8]
|
REG_EFA2_NAND_WR = (page ) & 0xff; // write address [15:8]
|
||||||
REG_EFA2_NAND_WR = (page >> 8 ) & 0xff; // write address[23:16]
|
REG_EFA2_NAND_WR = (page >> 8 ) & 0xff; // write address[23:16]
|
||||||
|
@ -280,7 +280,7 @@ bool EFA2_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
EFA2_Shutdown
|
EFA2_Shutdown
|
||||||
unload the EFA2 interface
|
unload the EFA2 interface
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool EFA2_Shutdown(void)
|
bool EFA2_Shutdown(void)
|
||||||
{
|
{
|
||||||
return EFA2_ClearStatus();
|
return EFA2_ClearStatus();
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ See gba_nds_fat.txt for help and license details.
|
||||||
// ID of Samsung K9K1G NAND flash chip
|
// ID of Samsung K9K1G NAND flash chip
|
||||||
#define EFA2_NAND_ID 0xEC79A5C0
|
#define EFA2_NAND_ID 0xEC79A5C0
|
||||||
|
|
||||||
// first sector of udisk
|
// first sector of udisk
|
||||||
#define EFA2_UDSK_START 0x40
|
#define EFA2_UDSK_START 0x40
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -422,7 +422,7 @@ void efa2_nand_lock(void) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set NAND Flash chip enable and write protection bits ?
|
// Set NAND Flash chip enable and write protection bits ?
|
||||||
//
|
//
|
||||||
// val | ~CE | ~WP |
|
// val | ~CE | ~WP |
|
||||||
// -----+-----+-----+
|
// -----+-----+-----+
|
||||||
// 0 | 0 | 0 |
|
// 0 | 0 | 0 |
|
||||||
|
@ -446,7 +446,7 @@ inline void efa2_nand_reset(void) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Read out NAND ID information, could be used for card detection
|
// Read out NAND ID information, could be used for card detection
|
||||||
//
|
//
|
||||||
// | EFA2 1GBit |
|
// | EFA2 1GBit |
|
||||||
// ------------------+------------+
|
// ------------------+------------+
|
||||||
// maker code | 0xEC |
|
// maker code | 0xEC |
|
||||||
|
@ -487,7 +487,7 @@ EFA2_ClearStatus
|
||||||
Reads and checks NAND status information
|
Reads and checks NAND status information
|
||||||
bool return OUT: true if NAND is idle
|
bool return OUT: true if NAND is idle
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool EFA2_ClearStatus (void)
|
bool EFA2_ClearStatus (void)
|
||||||
{
|
{
|
||||||
// tbd: currently there is no write support, so always return
|
// tbd: currently there is no write support, so always return
|
||||||
// true, there is no possibility for pending operations
|
// true, there is no possibility for pending operations
|
||||||
|
@ -499,7 +499,7 @@ EFA2_IsInserted
|
||||||
Checks to see if the NAND chip used by the EFA2 is present
|
Checks to see if the NAND chip used by the EFA2 is present
|
||||||
bool return OUT: true if the correct NAND chip is found
|
bool return OUT: true if the correct NAND chip is found
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool EFA2_IsInserted (void)
|
bool EFA2_IsInserted (void)
|
||||||
{
|
{
|
||||||
EFA2_ClearStatus();
|
EFA2_ClearStatus();
|
||||||
return (efa2_nand_id() == EFA2_NAND_ID);
|
return (efa2_nand_id() == EFA2_NAND_ID);
|
||||||
|
@ -544,7 +544,7 @@ bool EFA2_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
efa2_nand_reset();
|
efa2_nand_reset();
|
||||||
|
|
||||||
// set NAND to READ1 operation mode and transfer page address
|
// set NAND to READ1 operation mode and transfer page address
|
||||||
REG_EFA2_NAND_CMD = 0x00; // write READ1 command
|
REG_EFA2_NAND_CMD = 0x00; // write READ1 command
|
||||||
REG_EFA2_NAND_WR = 0x00; // write address [7:0]
|
REG_EFA2_NAND_WR = 0x00; // write address [7:0]
|
||||||
REG_EFA2_NAND_WR = (page ) & 0xff; // write address [15:8]
|
REG_EFA2_NAND_WR = (page ) & 0xff; // write address [15:8]
|
||||||
REG_EFA2_NAND_WR = (page >> 8 ) & 0xff; // write address[23:16]
|
REG_EFA2_NAND_WR = (page >> 8 ) & 0xff; // write address[23:16]
|
||||||
|
@ -601,7 +601,7 @@ bool EFA2_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
EFA2_Shutdown
|
EFA2_Shutdown
|
||||||
unload the EFA2 interface
|
unload the EFA2 interface
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool EFA2_Shutdown(void)
|
bool EFA2_Shutdown(void)
|
||||||
{
|
{
|
||||||
return EFA2_ClearStatus();
|
return EFA2_ClearStatus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
compact_flash.c
|
compact_flash.c
|
||||||
By chishm (Michael Chisholm)
|
By chishm (Michael Chisholm)
|
||||||
|
|
||||||
Hardware Routines for using a GBA Flash Cart and SRAM as a
|
Hardware Routines for using a GBA Flash Cart and SRAM as a
|
||||||
block device.
|
block device.
|
||||||
|
|
||||||
This software is completely free. No warranty is provided.
|
This software is completely free. No warranty is provided.
|
||||||
|
@ -57,7 +57,7 @@ FCSR_IsInserted
|
||||||
Is a GBA Flash Cart with a valid file system inserted?
|
Is a GBA Flash Cart with a valid file system inserted?
|
||||||
bool return OUT: true if a GBA FC card is inserted
|
bool return OUT: true if a GBA FC card is inserted
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool FCSR_IsInserted (void)
|
bool FCSR_IsInserted (void)
|
||||||
{
|
{
|
||||||
bool flagFoundFileSys = false;
|
bool flagFoundFileSys = false;
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ FCSR_ClearStatus
|
||||||
Finish any pending operations
|
Finish any pending operations
|
||||||
bool return OUT: always true for GBA FC
|
bool return OUT: always true for GBA FC
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool FCSR_ClearStatus (void)
|
bool FCSR_ClearStatus (void)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ void* buffer OUT: pointer to 512 byte buffer to store data in
|
||||||
bool return OUT: true if successful
|
bool return OUT: true if successful
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool FCSR_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
bool FCSR_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
bool flagSramSector = false;
|
bool flagSramSector = false;
|
||||||
int numSectors = (numSecs > 0 ? numSecs : 256);
|
int numSectors = (numSecs > 0 ? numSecs : 256);
|
||||||
|
@ -208,14 +208,14 @@ bool FCSR_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
FCSR_Shutdown
|
FCSR_Shutdown
|
||||||
unload the Flash Cart interface
|
unload the Flash Cart interface
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool FCSR_Shutdown(void)
|
bool FCSR_Shutdown(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (FCSR_ClearStatus() == false)
|
if (FCSR_ClearStatus() == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FCSR_FileSysPointer = 0;
|
FCSR_FileSysPointer = 0;
|
||||||
|
|
||||||
for (i=0; i < 4; i++)
|
for (i=0; i < 4; i++)
|
||||||
{
|
{
|
||||||
FCSR_SramSectorPointer[i] = 0;
|
FCSR_SramSectorPointer[i] = 0;
|
||||||
|
@ -262,11 +262,11 @@ bool FCSR_StartUp(void)
|
||||||
// Get SRAM sector regions from header block
|
// Get SRAM sector regions from header block
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
FCSR_SramSectorStart[i] = fileSysPointer[i+4];
|
FCSR_SramSectorStart[i] = fileSysPointer[i+4];
|
||||||
SramRegionSize[i] = fileSysPointer[i+8];
|
SramRegionSize[i] = fileSysPointer[i+8];
|
||||||
FCSR_SramSectorEnd[i] = FCSR_SramSectorStart[i] + SramRegionSize[i];
|
FCSR_SramSectorEnd[i] = FCSR_SramSectorStart[i] + SramRegionSize[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate SRAM region pointers
|
// Calculate SRAM region pointers
|
||||||
FCSR_SramSectorPointer[0] = (u8*)(SRAM_START + 4);
|
FCSR_SramSectorPointer[0] = (u8*)(SRAM_START + 4);
|
||||||
for (i = 1; i < 4; i++)
|
for (i = 1; i < 4; i++)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
io_fcsr.h
|
io_fcsr.h
|
||||||
|
|
||||||
Hardware Routines for using a GBA Flash Cart with SRAM
|
Hardware Routines for using a GBA Flash Cart with SRAM
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ extern LPIO_INTERFACE FCSR_GetInterface(void) ;
|
||||||
|
|
||||||
#endif // define IO_FCSR_H
|
#endif // define IO_FCSR_H
|
||||||
/*
|
/*
|
||||||
io_fcsr.h
|
io_fcsr.h
|
||||||
|
|
||||||
Hardware Routines for using a GBA Flash Cart with SRAM
|
Hardware Routines for using a GBA Flash Cart with SRAM
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/*
|
/*
|
||||||
io_m3_common.c
|
io_m3_common.c
|
||||||
|
|
||||||
Routines common to all version of the M3
|
Routines common to all version of the M3
|
||||||
|
|
||||||
Some code based on M3 SD drivers supplied by M3Adapter.
|
Some code based on M3 SD drivers supplied by M3Adapter.
|
||||||
Some code written by SaTa may have been unknowingly used.
|
Some code written by SaTa may have been unknowingly used.
|
||||||
|
|
||||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
are permitted provided that the following conditions are met:
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ void _M3_changeMode (u32 mode) {
|
||||||
_M3_readHalfword (0x08000000 + (mode << 1));
|
_M3_readHalfword (0x08000000 + (mode << 1));
|
||||||
_M3_readHalfword (0x0800080e);
|
_M3_readHalfword (0x0800080e);
|
||||||
_M3_readHalfword (0x08000000);
|
_M3_readHalfword (0x08000000);
|
||||||
|
|
||||||
if ((mode & 0x0f) != 4) {
|
if ((mode & 0x0f) != 4) {
|
||||||
_M3_readHalfword (0x09000000);
|
_M3_readHalfword (0x09000000);
|
||||||
} else {
|
} else {
|
||||||
|
@ -56,5 +56,5 @@ void _M3_changeMode (u32 mode) {
|
||||||
_M3_readHalfword (0x08000188);
|
_M3_readHalfword (0x08000188);
|
||||||
_M3_readHalfword (0x08000188);
|
_M3_readHalfword (0x08000188);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
io_m3_common.h
|
io_m3_common.h
|
||||||
|
|
||||||
Routines common to all version of the M3
|
Routines common to all version of the M3
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
Some code written by SaTa may have been unknowingly used.
|
Some code written by SaTa may have been unknowingly used.
|
||||||
|
|
||||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
are permitted provided that the following conditions are met:
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
// Values for changing mode
|
// Values for changing mode
|
||||||
#define M3_MODE_ROM 0x00400004
|
#define M3_MODE_ROM 0x00400004
|
||||||
#define M3_MODE_MEDIA 0x00400003
|
#define M3_MODE_MEDIA 0x00400003
|
||||||
|
|
||||||
extern void _M3_changeMode (u32 mode);
|
extern void _M3_changeMode (u32 mode);
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ M3CF_IsInserted
|
||||||
Is a compact flash card inserted?
|
Is a compact flash card inserted?
|
||||||
bool return OUT: true if a CF card is inserted
|
bool return OUT: true if a CF card is inserted
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool M3CF_IsInserted (void)
|
bool M3CF_IsInserted (void)
|
||||||
{
|
{
|
||||||
// Change register, then check if value did change
|
// Change register, then check if value did change
|
||||||
M3_REG_STS = CF_STS_INSERTED;
|
M3_REG_STS = CF_STS_INSERTED;
|
||||||
|
@ -86,17 +86,17 @@ M3CF_ClearStatus
|
||||||
Tries to make the CF card go back to idle mode
|
Tries to make the CF card go back to idle mode
|
||||||
bool return OUT: true if a CF card is idle
|
bool return OUT: true if a CF card is idle
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool M3CF_ClearStatus (void)
|
bool M3CF_ClearStatus (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Wait until CF card is finished previous commands
|
// Wait until CF card is finished previous commands
|
||||||
i=0;
|
i=0;
|
||||||
while ((M3_REG_CMD & CF_STS_BUSY) && (i < CARD_TIMEOUT))
|
while ((M3_REG_CMD & CF_STS_BUSY) && (i < CARD_TIMEOUT))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until card is ready for commands
|
// Wait until card is ready for commands
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((!(M3_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
while ((!(M3_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
||||||
|
@ -128,7 +128,7 @@ bool M3CF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
u8 *buff_u8 = (u8*)buffer;
|
u8 *buff_u8 = (u8*)buffer;
|
||||||
int temp;
|
int temp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _CF_USE_DMA && defined NDS && defined ARM9
|
#if defined _CF_USE_DMA && defined NDS && defined ARM9
|
||||||
DC_FlushRange( buffer, j * BYTE_PER_READ);
|
DC_FlushRange( buffer, j * BYTE_PER_READ);
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,7 +139,7 @@ bool M3CF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until card is ready for commands
|
// Wait until card is ready for commands
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((!(M3_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
while ((!(M3_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
||||||
|
@ -148,20 +148,20 @@ bool M3CF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
if (i >= CARD_TIMEOUT)
|
if (i >= CARD_TIMEOUT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set number of sectors to read
|
// Set number of sectors to read
|
||||||
M3_REG_SEC = numSecs;
|
M3_REG_SEC = numSecs;
|
||||||
|
|
||||||
// Set read sector
|
// Set read sector
|
||||||
M3_REG_LBA1 = sector & 0xFF; // 1st byte of sector number
|
M3_REG_LBA1 = sector & 0xFF; // 1st byte of sector number
|
||||||
M3_REG_LBA2 = (sector >> 8) & 0xFF; // 2nd byte of sector number
|
M3_REG_LBA2 = (sector >> 8) & 0xFF; // 2nd byte of sector number
|
||||||
M3_REG_LBA3 = (sector >> 16) & 0xFF; // 3rd byte of sector number
|
M3_REG_LBA3 = (sector >> 16) & 0xFF; // 3rd byte of sector number
|
||||||
M3_REG_LBA4 = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
|
M3_REG_LBA4 = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
|
||||||
|
|
||||||
// Set command to read
|
// Set command to read
|
||||||
M3_REG_CMD = CF_CMD_READ;
|
M3_REG_CMD = CF_CMD_READ;
|
||||||
|
|
||||||
|
|
||||||
while (j--)
|
while (j--)
|
||||||
{
|
{
|
||||||
// Wait until card is ready for reading
|
// Wait until card is ready for reading
|
||||||
|
@ -172,7 +172,7 @@ bool M3CF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
if (i >= CARD_TIMEOUT)
|
if (i >= CARD_TIMEOUT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Read data
|
// Read data
|
||||||
#ifdef _CF_USE_DMA
|
#ifdef _CF_USE_DMA
|
||||||
#ifdef NDS
|
#ifdef NDS
|
||||||
|
@ -194,12 +194,12 @@ bool M3CF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(i--)
|
while(i--)
|
||||||
*buff++ = *M3_DATA;
|
*buff++ = *M3_DATA;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
i=256;
|
i=256;
|
||||||
while(i--)
|
while(i--)
|
||||||
*buff++ = *M3_DATA;
|
*buff++ = *M3_DATA;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if defined _CF_USE_DMA && defined NDS
|
#if defined _CF_USE_DMA && defined NDS
|
||||||
|
@ -230,7 +230,7 @@ bool M3CF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
u8 *buff_u8 = (u8*)buffer;
|
u8 *buff_u8 = (u8*)buffer;
|
||||||
int temp;
|
int temp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _CF_USE_DMA && defined NDS && defined ARM9
|
#if defined _CF_USE_DMA && defined NDS && defined ARM9
|
||||||
DC_FlushRange( buffer, j * BYTE_PER_READ);
|
DC_FlushRange( buffer, j * BYTE_PER_READ);
|
||||||
#endif
|
#endif
|
||||||
|
@ -241,7 +241,7 @@ bool M3CF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until card is ready for commands
|
// Wait until card is ready for commands
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((!(M3_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
while ((!(M3_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
||||||
|
@ -250,19 +250,19 @@ bool M3CF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
if (i >= CARD_TIMEOUT)
|
if (i >= CARD_TIMEOUT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set number of sectors to write
|
// Set number of sectors to write
|
||||||
M3_REG_SEC = numSecs;
|
M3_REG_SEC = numSecs;
|
||||||
|
|
||||||
// Set write sector
|
// Set write sector
|
||||||
M3_REG_LBA1 = sector & 0xFF; // 1st byte of sector number
|
M3_REG_LBA1 = sector & 0xFF; // 1st byte of sector number
|
||||||
M3_REG_LBA2 = (sector >> 8) & 0xFF; // 2nd byte of sector number
|
M3_REG_LBA2 = (sector >> 8) & 0xFF; // 2nd byte of sector number
|
||||||
M3_REG_LBA3 = (sector >> 16) & 0xFF; // 3rd byte of sector number
|
M3_REG_LBA3 = (sector >> 16) & 0xFF; // 3rd byte of sector number
|
||||||
M3_REG_LBA4 = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
|
M3_REG_LBA4 = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
|
||||||
|
|
||||||
// Set command to write
|
// Set command to write
|
||||||
M3_REG_CMD = CF_CMD_WRITE;
|
M3_REG_CMD = CF_CMD_WRITE;
|
||||||
|
|
||||||
while (j--)
|
while (j--)
|
||||||
{
|
{
|
||||||
// Wait until card is ready for writing
|
// Wait until card is ready for writing
|
||||||
|
@ -273,7 +273,7 @@ bool M3CF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
if (i >= CARD_TIMEOUT)
|
if (i >= CARD_TIMEOUT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
#ifdef _CF_USE_DMA
|
#ifdef _CF_USE_DMA
|
||||||
#ifdef NDS
|
#ifdef NDS
|
||||||
|
@ -295,19 +295,19 @@ bool M3CF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(i--)
|
while(i--)
|
||||||
*M3_DATA = *buff++;
|
*M3_DATA = *buff++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
i=256;
|
i=256;
|
||||||
while(i--)
|
while(i--)
|
||||||
*M3_DATA = *buff++;
|
*M3_DATA = *buff++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if defined _CF_USE_DMA && defined NDS
|
#if defined _CF_USE_DMA && defined NDS
|
||||||
// Wait for end of transfer before returning
|
// Wait for end of transfer before returning
|
||||||
while(DMA3_CR & DMA_BUSY);
|
while(DMA3_CR & DMA_BUSY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ M3_Unlock
|
||||||
Returns true if M3 was unlocked, false if failed
|
Returns true if M3 was unlocked, false if failed
|
||||||
Added by MightyMax
|
Added by MightyMax
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool M3_Unlock(void)
|
bool M3_Unlock(void)
|
||||||
{
|
{
|
||||||
// run unlock sequence
|
// run unlock sequence
|
||||||
volatile unsigned short tmp ;
|
volatile unsigned short tmp ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
io_m3cf.h
|
io_m3cf.h
|
||||||
|
|
||||||
Hardware Routines for reading a compact flash card
|
Hardware Routines for reading a compact flash card
|
||||||
using the M3 CF
|
using the M3 CF
|
||||||
|
@ -24,7 +24,7 @@ extern LPIO_INTERFACE M3CF_GetInterface(void) ;
|
||||||
|
|
||||||
#endif // define IO_M3CF_H
|
#endif // define IO_M3CF_H
|
||||||
/*
|
/*
|
||||||
io_m3cf.h
|
io_m3cf.h
|
||||||
|
|
||||||
Hardware Routines for reading a compact flash card
|
Hardware Routines for reading a compact flash card
|
||||||
using the M3 CF
|
using the M3 CF
|
||||||
|
|
|
@ -218,7 +218,7 @@ void M3SD_writesector(u16 * p,u32 sectorn)
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ((verify > 0) && (tries < 16));
|
} while ((verify > 0) && (tries < 16));
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
free(check);
|
free(check);
|
||||||
} // */
|
} // */
|
||||||
|
@ -356,7 +356,7 @@ bool M3SD_Shutdown(void)
|
||||||
bool M3SD_StartUp(void)
|
bool M3SD_StartUp(void)
|
||||||
{
|
{
|
||||||
vu16* waitCr = (vu16*)0x4000204;
|
vu16* waitCr = (vu16*)0x4000204;
|
||||||
|
|
||||||
*waitCr |= 0x6000;
|
*waitCr |= 0x6000;
|
||||||
// *(vu16*)0x4000204=0x6000;
|
// *(vu16*)0x4000204=0x6000;
|
||||||
// Try unlocking 3 times, because occationally it fails to detect the reader.
|
// Try unlocking 3 times, because occationally it fails to detect the reader.
|
||||||
|
|
|
@ -54,7 +54,7 @@ sd_write_loop2:
|
||||||
|
|
||||||
sd_write_busy:
|
sd_write_busy:
|
||||||
bl clkin
|
bl clkin
|
||||||
ldrh r0,[r1]
|
ldrh r0,[r1]
|
||||||
tst r0,#0x100
|
tst r0,#0x100
|
||||||
beq sd_write_busy
|
beq sd_write_busy
|
||||||
ldmfd r13!,{r0-r1}
|
ldmfd r13!,{r0-r1}
|
||||||
|
@ -68,10 +68,10 @@ SD_crc16:
|
||||||
stmfd r13!,{r4-r9}
|
stmfd r13!,{r4-r9}
|
||||||
mov r9,r2
|
mov r9,r2
|
||||||
|
|
||||||
mov r3,#0
|
mov r3,#0
|
||||||
mov r4,#0
|
mov r4,#0
|
||||||
mov r5,#0
|
mov r5,#0
|
||||||
mov r6,#0
|
mov r6,#0
|
||||||
|
|
||||||
ldr r7,=0x80808080
|
ldr r7,=0x80808080
|
||||||
ldr r8,=0x1021
|
ldr r8,=0x1021
|
||||||
|
@ -86,19 +86,19 @@ sd_crc16_loop:
|
||||||
eorne r3,r3,r8
|
eorne r3,r3,r8
|
||||||
tst r2,r7,lsr #24
|
tst r2,r7,lsr #24
|
||||||
eorne r3,r3,r8
|
eorne r3,r3,r8
|
||||||
|
|
||||||
mov r4,r4,lsl #1
|
mov r4,r4,lsl #1
|
||||||
tst r4,#0x10000
|
tst r4,#0x10000
|
||||||
eorne r4,r4,r8
|
eorne r4,r4,r8
|
||||||
tst r2,r7,lsr #25
|
tst r2,r7,lsr #25
|
||||||
eorne r4,r4,r8
|
eorne r4,r4,r8
|
||||||
|
|
||||||
mov r5,r5,lsl #1
|
mov r5,r5,lsl #1
|
||||||
tst r5,#0x10000
|
tst r5,#0x10000
|
||||||
eorne r5,r5,r8
|
eorne r5,r5,r8
|
||||||
tst r2,r7,lsr #26
|
tst r2,r7,lsr #26
|
||||||
eorne r5,r5,r8
|
eorne r5,r5,r8
|
||||||
|
|
||||||
mov r6,r6,lsl #1
|
mov r6,r6,lsl #1
|
||||||
tst r6,#0x10000
|
tst r6,#0x10000
|
||||||
eorne r6,r6,r8
|
eorne r6,r6,r8
|
||||||
|
@ -107,7 +107,7 @@ sd_crc16_loop:
|
||||||
|
|
||||||
mov r7,r7,ror #4
|
mov r7,r7,ror #4
|
||||||
subs r1,r1,#4
|
subs r1,r1,#4
|
||||||
bne sd_crc16_loop
|
bne sd_crc16_loop
|
||||||
|
|
||||||
mov r2,r9
|
mov r2,r9
|
||||||
mov r8,#16
|
mov r8,#16
|
||||||
|
@ -145,7 +145,7 @@ SD_data_write:
|
||||||
mov r2,#SDODA
|
mov r2,#SDODA
|
||||||
sd_data_write_busy:
|
sd_data_write_busy:
|
||||||
bl clkin
|
bl clkin
|
||||||
ldrh r3,[r2]
|
ldrh r3,[r2]
|
||||||
tst r3,#0x100
|
tst r3,#0x100
|
||||||
beq sd_data_write_busy
|
beq sd_data_write_busy
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ sd_data_write_loop:
|
||||||
bl clkout
|
bl clkout
|
||||||
|
|
||||||
subs r5, r5, #2
|
subs r5, r5, #2
|
||||||
bne sd_data_write_loop
|
bne sd_data_write_loop
|
||||||
|
|
||||||
cmp r1,#0
|
cmp r1,#0
|
||||||
movne r0,r1
|
movne r0,r1
|
||||||
|
@ -184,10 +184,10 @@ sd_data_write_loop2:
|
||||||
bl clkout
|
bl clkout
|
||||||
subs r5, r5, #1
|
subs r5, r5, #1
|
||||||
bne sd_data_write_loop2
|
bne sd_data_write_loop2
|
||||||
|
|
||||||
sd_data_write_busy2:
|
sd_data_write_busy2:
|
||||||
bl clkin
|
bl clkin
|
||||||
ldrh r3,[r2]
|
ldrh r3,[r2]
|
||||||
tst r3,#0x100
|
tst r3,#0x100
|
||||||
beq sd_data_write_busy2
|
beq sd_data_write_busy2
|
||||||
|
|
||||||
|
|
|
@ -74,14 +74,14 @@ static bool cf_block_ready(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
while (!(CF_RD_STATUS & 0x40));
|
while (!(CF_RD_STATUS & 0x40));
|
||||||
} while (CF_RD_STATUS & 0x80);
|
} while (CF_RD_STATUS & 0x80);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
while ( (!(CF_RD_STATUS & 0x40)) && (i < CARD_TIMEOUT) ) i++;
|
while ( (!(CF_RD_STATUS & 0x40)) && (i < CARD_TIMEOUT) ) i++;
|
||||||
} while ( (CF_RD_STATUS & 0x80) && (i < CARD_TIMEOUT) );
|
} while ( (CF_RD_STATUS & 0x80) && (i < CARD_TIMEOUT) );
|
||||||
|
|
||||||
if (i >= CARD_TIMEOUT) {
|
if (i >= CARD_TIMEOUT) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -110,7 +110,7 @@ MMCF_IsInserted
|
||||||
Is a compact flash card inserted?
|
Is a compact flash card inserted?
|
||||||
bool return OUT: true if a CF card is inserted
|
bool return OUT: true if a CF card is inserted
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool MMCF_IsInserted (void)
|
bool MMCF_IsInserted (void)
|
||||||
{
|
{
|
||||||
if ( !cf_set_features(0xAA) ) return false;
|
if ( !cf_set_features(0xAA) ) return false;
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ MMCF_ClearStatus
|
||||||
Tries to make the CF card go back to idle mode
|
Tries to make the CF card go back to idle mode
|
||||||
bool return OUT: true if a CF card is idle
|
bool return OUT: true if a CF card is idle
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool MMCF_ClearStatus (void)
|
bool MMCF_ClearStatus (void)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ bool MMCF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(i--)
|
while(i--)
|
||||||
*buff++ = *MP_DATA;
|
*buff++ = *MP_DATA;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
i=256;
|
i=256;
|
||||||
|
@ -222,15 +222,15 @@ bool MMCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
u8 *buff_u8 = (u8*)buffer;
|
u8 *buff_u8 = (u8*)buffer;
|
||||||
int temp;
|
int temp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _CF_USE_DMA && defined NDS && defined ARM9
|
#if defined _CF_USE_DMA && defined NDS && defined ARM9
|
||||||
DC_FlushRange( buffer, j * BYTE_PER_READ);
|
DC_FlushRange( buffer, j * BYTE_PER_READ);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (numSecs > 1)
|
if (numSecs > 1)
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
for (r = 0; r < numSecs; r++)
|
for (r = 0; r < numSecs; r++)
|
||||||
{
|
{
|
||||||
MMCF_WriteSectors(sector + r, 1, ((unsigned char *) (buffer)) + 512);
|
MMCF_WriteSectors(sector + r, 1, ((unsigned char *) (buffer)) + 512);
|
||||||
|
@ -270,12 +270,12 @@ bool MMCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(i--)
|
while(i--)
|
||||||
*MP_DATA = *buff++;
|
*MP_DATA = *buff++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
i=256;
|
i=256;
|
||||||
while(i--)
|
while(i--)
|
||||||
*MP_DATA = *buff++;
|
*MP_DATA = *buff++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ bool MMCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
#if defined _CF_USE_DMA && defined NDS
|
#if defined _CF_USE_DMA && defined NDS
|
||||||
// Wait for end of transfer before returning
|
// Wait for end of transfer before returning
|
||||||
while(DMA3_CR & DMA_BUSY);
|
while(DMA3_CR & DMA_BUSY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define _CF_VERIFY
|
//#define _CF_VERIFY
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ bool MMCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
MMCF_Shutdown
|
MMCF_Shutdown
|
||||||
unload the GBAMP CF interface
|
unload the GBAMP CF interface
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool MMCF_Shutdown(void)
|
bool MMCF_Shutdown(void)
|
||||||
{
|
{
|
||||||
return MMCF_ClearStatus() ;
|
return MMCF_ClearStatus() ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
io_mmcf.h
|
io_mmcf.h
|
||||||
|
|
||||||
Hardware Routines for reading a compact flash card
|
Hardware Routines for reading a compact flash card
|
||||||
using the GBA Movie Player
|
using the GBA Movie Player
|
||||||
|
|
|
@ -73,7 +73,7 @@ MPCF_IsInserted
|
||||||
Is a compact flash card inserted?
|
Is a compact flash card inserted?
|
||||||
bool return OUT: true if a CF card is inserted
|
bool return OUT: true if a CF card is inserted
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool MPCF_IsInserted (void)
|
bool MPCF_IsInserted (void)
|
||||||
{
|
{
|
||||||
// Change register, then check if value did change
|
// Change register, then check if value did change
|
||||||
MP_REG_STS = CF_STS_INSERTED;
|
MP_REG_STS = CF_STS_INSERTED;
|
||||||
|
@ -86,17 +86,17 @@ MPCF_ClearStatus
|
||||||
Tries to make the CF card go back to idle mode
|
Tries to make the CF card go back to idle mode
|
||||||
bool return OUT: true if a CF card is idle
|
bool return OUT: true if a CF card is idle
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool MPCF_ClearStatus (void)
|
bool MPCF_ClearStatus (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Wait until CF card is finished previous commands
|
// Wait until CF card is finished previous commands
|
||||||
i=0;
|
i=0;
|
||||||
while ((MP_REG_CMD & CF_STS_BUSY) && (i < CARD_TIMEOUT))
|
while ((MP_REG_CMD & CF_STS_BUSY) && (i < CARD_TIMEOUT))
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until card is ready for commands
|
// Wait until card is ready for commands
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((!(MP_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
while ((!(MP_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
||||||
|
@ -139,7 +139,7 @@ bool MPCF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until card is ready for commands
|
// Wait until card is ready for commands
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((!(MP_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
while ((!(MP_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
||||||
|
@ -148,20 +148,20 @@ bool MPCF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
if (i >= CARD_TIMEOUT)
|
if (i >= CARD_TIMEOUT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set number of sectors to read
|
// Set number of sectors to read
|
||||||
MP_REG_SEC = numSecs;
|
MP_REG_SEC = numSecs;
|
||||||
|
|
||||||
// Set read sector
|
// Set read sector
|
||||||
MP_REG_LBA1 = sector & 0xFF; // 1st byte of sector number
|
MP_REG_LBA1 = sector & 0xFF; // 1st byte of sector number
|
||||||
MP_REG_LBA2 = (sector >> 8) & 0xFF; // 2nd byte of sector number
|
MP_REG_LBA2 = (sector >> 8) & 0xFF; // 2nd byte of sector number
|
||||||
MP_REG_LBA3 = (sector >> 16) & 0xFF; // 3rd byte of sector number
|
MP_REG_LBA3 = (sector >> 16) & 0xFF; // 3rd byte of sector number
|
||||||
MP_REG_LBA4 = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
|
MP_REG_LBA4 = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
|
||||||
|
|
||||||
// Set command to read
|
// Set command to read
|
||||||
MP_REG_CMD = CF_CMD_READ;
|
MP_REG_CMD = CF_CMD_READ;
|
||||||
|
|
||||||
|
|
||||||
while (j--)
|
while (j--)
|
||||||
{
|
{
|
||||||
// Wait until card is ready for reading
|
// Wait until card is ready for reading
|
||||||
|
@ -172,7 +172,7 @@ bool MPCF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
if (i >= CARD_TIMEOUT)
|
if (i >= CARD_TIMEOUT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Read data
|
// Read data
|
||||||
#ifdef _CF_USE_DMA
|
#ifdef _CF_USE_DMA
|
||||||
#ifdef NDS
|
#ifdef NDS
|
||||||
|
@ -194,12 +194,12 @@ bool MPCF_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(i--)
|
while(i--)
|
||||||
*buff++ = *MP_DATA;
|
*buff++ = *MP_DATA;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
i=256;
|
i=256;
|
||||||
while(i--)
|
while(i--)
|
||||||
*buff++ = *MP_DATA;
|
*buff++ = *MP_DATA;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if (defined _CF_USE_DMA) && (defined NDS)
|
#if (defined _CF_USE_DMA) && (defined NDS)
|
||||||
|
@ -229,7 +229,7 @@ bool MPCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
u8 *buff_u8 = (u8*)buffer;
|
u8 *buff_u8 = (u8*)buffer;
|
||||||
int temp;
|
int temp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _CF_USE_DMA && defined NDS && defined ARM9
|
#if defined _CF_USE_DMA && defined NDS && defined ARM9
|
||||||
DC_FlushRange( buffer, j * BYTE_PER_READ);
|
DC_FlushRange( buffer, j * BYTE_PER_READ);
|
||||||
#endif
|
#endif
|
||||||
|
@ -240,7 +240,7 @@ bool MPCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until card is ready for commands
|
// Wait until card is ready for commands
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((!(MP_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
while ((!(MP_REG_STS & CF_STS_INSERTED)) && (i < CARD_TIMEOUT))
|
||||||
|
@ -249,19 +249,19 @@ bool MPCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
if (i >= CARD_TIMEOUT)
|
if (i >= CARD_TIMEOUT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set number of sectors to write
|
// Set number of sectors to write
|
||||||
MP_REG_SEC = numSecs;
|
MP_REG_SEC = numSecs;
|
||||||
|
|
||||||
// Set write sector
|
// Set write sector
|
||||||
MP_REG_LBA1 = sector & 0xFF; // 1st byte of sector number
|
MP_REG_LBA1 = sector & 0xFF; // 1st byte of sector number
|
||||||
MP_REG_LBA2 = (sector >> 8) & 0xFF; // 2nd byte of sector number
|
MP_REG_LBA2 = (sector >> 8) & 0xFF; // 2nd byte of sector number
|
||||||
MP_REG_LBA3 = (sector >> 16) & 0xFF; // 3rd byte of sector number
|
MP_REG_LBA3 = (sector >> 16) & 0xFF; // 3rd byte of sector number
|
||||||
MP_REG_LBA4 = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
|
MP_REG_LBA4 = ((sector >> 24) & 0x0F )| CF_CMD_LBA; // last nibble of sector number
|
||||||
|
|
||||||
// Set command to write
|
// Set command to write
|
||||||
MP_REG_CMD = CF_CMD_WRITE;
|
MP_REG_CMD = CF_CMD_WRITE;
|
||||||
|
|
||||||
while (j--)
|
while (j--)
|
||||||
{
|
{
|
||||||
// Wait until card is ready for writing
|
// Wait until card is ready for writing
|
||||||
|
@ -272,7 +272,7 @@ bool MPCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
if (i >= CARD_TIMEOUT)
|
if (i >= CARD_TIMEOUT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
#ifdef _CF_USE_DMA
|
#ifdef _CF_USE_DMA
|
||||||
#ifdef NDS
|
#ifdef NDS
|
||||||
|
@ -294,19 +294,19 @@ bool MPCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(i--)
|
while(i--)
|
||||||
*MP_DATA = *buff++;
|
*MP_DATA = *buff++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
i=256;
|
i=256;
|
||||||
while(i--)
|
while(i--)
|
||||||
*MP_DATA = *buff++;
|
*MP_DATA = *buff++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if defined _CF_USE_DMA && defined NDS
|
#if defined _CF_USE_DMA && defined NDS
|
||||||
// Wait for end of transfer before returning
|
// Wait for end of transfer before returning
|
||||||
while(DMA3_CR & DMA_BUSY);
|
while(DMA3_CR & DMA_BUSY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ bool MPCF_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
MPCF_Shutdown
|
MPCF_Shutdown
|
||||||
unload the GBAMP CF interface
|
unload the GBAMP CF interface
|
||||||
-----------------------------------------------------------------*/
|
-----------------------------------------------------------------*/
|
||||||
bool MPCF_Shutdown(void)
|
bool MPCF_Shutdown(void)
|
||||||
{
|
{
|
||||||
return MPCF_ClearStatus() ;
|
return MPCF_ClearStatus() ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
io_mpcf.h
|
io_mpcf.h
|
||||||
|
|
||||||
Hardware Routines for reading a compact flash card
|
Hardware Routines for reading a compact flash card
|
||||||
using the GBA Movie Player
|
using the GBA Movie Player
|
||||||
|
@ -24,7 +24,7 @@ extern LPIO_INTERFACE MPCF_GetInterface(void) ;
|
||||||
|
|
||||||
#endif // define IO_MPCF_H
|
#endif // define IO_MPCF_H
|
||||||
/*
|
/*
|
||||||
io_mpcf.h
|
io_mpcf.h
|
||||||
|
|
||||||
Hardware Routines for reading a compact flash card
|
Hardware Routines for reading a compact flash card
|
||||||
using the GBA Movie Player
|
using the GBA Movie Player
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
|
|
||||||
Hardware Routines for reading an SD card using
|
Hardware Routines for reading an SD card using
|
||||||
a NinjaDS SD adapter.
|
a NinjaDS SD adapter.
|
||||||
|
|
||||||
Original code supplied by NinjaMod
|
Original code supplied by NinjaMod
|
||||||
|
|
||||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
are permitted provided that the following conditions are met:
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
2006-08-05 - Chishm
|
2006-08-05 - Chishm
|
||||||
* First release
|
* First release
|
||||||
*/
|
*/
|
||||||
|
@ -84,7 +84,7 @@ static u32 _NJSD_relativeCardAddress = 0;
|
||||||
static inline bool _NJSD_waitIRQ(void) {
|
static inline bool _NJSD_waitIRQ(void) {
|
||||||
/*#ifdef _NJSD_SYNC
|
/*#ifdef _NJSD_SYNC
|
||||||
int i = IRQ_TIMEOUT;
|
int i = IRQ_TIMEOUT;
|
||||||
while (!(REG_IF & 0x100000) && --i);
|
while (!(REG_IF & 0x100000) && --i);
|
||||||
REG_IF = 0x100000;
|
REG_IF = 0x100000;
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -96,7 +96,7 @@ static inline bool _NJSD_waitIRQ(void) {
|
||||||
//if (!(REG_IME & 1))
|
//if (!(REG_IME & 1))
|
||||||
//{
|
//{
|
||||||
// irq's disabled...
|
// irq's disabled...
|
||||||
while (!(REG_IF & 0x100000) && (!(_NJSD_irqFlag)) && --i);
|
while (!(REG_IF & 0x100000) && (!(_NJSD_irqFlag)) && --i);
|
||||||
_NJSD_irqFlag = 0;
|
_NJSD_irqFlag = 0;
|
||||||
REG_IF = 0x100000;
|
REG_IF = 0x100000;
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
|
@ -106,7 +106,7 @@ static inline bool _NJSD_waitIRQ(void) {
|
||||||
}
|
}
|
||||||
//} else {
|
//} else {
|
||||||
// irq's enabled
|
// irq's enabled
|
||||||
// while (!(_NJSD_irqFlag) && --i);
|
// while (!(_NJSD_irqFlag) && --i);
|
||||||
// _NJSD_irqFlag = 0;
|
// _NJSD_irqFlag = 0;
|
||||||
// REG_IF = 0x100000;
|
// REG_IF = 0x100000;
|
||||||
// if (i <= 0) {
|
// if (i <= 0) {
|
||||||
|
@ -118,8 +118,8 @@ static inline bool _NJSD_waitIRQ(void) {
|
||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void _NJSD_writeCardCommand
|
static inline void _NJSD_writeCardCommand
|
||||||
(u8 cmd0, u8 cmd1, u8 cmd2, u8 cmd3, u8 cmd4, u8 cmd5, u8 cmd6, u8 cmd7)
|
(u8 cmd0, u8 cmd1, u8 cmd2, u8 cmd3, u8 cmd4, u8 cmd5, u8 cmd6, u8 cmd7)
|
||||||
{
|
{
|
||||||
CARD_COMMAND[0] = cmd0;
|
CARD_COMMAND[0] = cmd0;
|
||||||
CARD_COMMAND[1] = cmd1;
|
CARD_COMMAND[1] = cmd1;
|
||||||
|
@ -142,7 +142,7 @@ static bool _NJSD_reset (void) {
|
||||||
if (i <= 0) {
|
if (i <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ static bool _NJSD_sendCMDR (int speed, u8 *rsp_buf, int type, u8 cmd, u32 param)
|
||||||
REG_IME = 0;
|
REG_IME = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
REG_IE &= ~0x100000;
|
REG_IE &= ~0x100000;
|
||||||
REG_IF = 0x100000;
|
REG_IF = 0x100000;
|
||||||
|
|
||||||
CARD_CR1H = CARD_CR1_ENABLE;
|
CARD_CR1H = CARD_CR1_ENABLE;
|
||||||
|
@ -191,7 +191,7 @@ static bool _NJSD_sendCMDR (int speed, u8 *rsp_buf, int type, u8 cmd, u32 param)
|
||||||
} else {
|
} else {
|
||||||
CARD_COMMAND[0] = 0xF0 | (speed << 2) | 0 | (1 << 1);
|
CARD_COMMAND[0] = 0xF0 | (speed << 2) | 0 | (1 << 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CARD_COMMAND[1] = (type & 0x40) | ((( type >> 2) & 7) << 3);
|
CARD_COMMAND[1] = (type & 0x40) | ((( type >> 2) & 7) << 3);
|
||||||
CARD_COMMAND[2] = 0x40 | cmd;
|
CARD_COMMAND[2] = 0x40 | cmd;
|
||||||
CARD_COMMAND[3] = (param>>24) & 0xFF;
|
CARD_COMMAND[3] = (param>>24) & 0xFF;
|
||||||
|
@ -301,7 +301,7 @@ static bool _NJSD_writeSector (u8 *buffer, u8 *crc_buf, u32 offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
REG_IE &= ~0x100000;
|
REG_IE &= ~0x100000;
|
||||||
REG_IF = 0x100000;
|
REG_IF = 0x100000;
|
||||||
|
|
||||||
CARD_CR1H = CARD_CR1_ENABLE;
|
CARD_CR1H = CARD_CR1_ENABLE;
|
||||||
|
@ -334,7 +334,7 @@ static bool _NJSD_writeSector (u8 *buffer, u8 *crc_buf, u32 offset) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
} while (CARD_CR2 & CARD_BUSY);
|
} while (CARD_CR2 & CARD_BUSY);
|
||||||
|
|
||||||
i = WRITE_TIMEOUT;
|
i = WRITE_TIMEOUT;
|
||||||
responseBuffer[3] = 0;
|
responseBuffer[3] = 0;
|
||||||
do {
|
do {
|
||||||
|
@ -352,7 +352,7 @@ static bool _NJSD_writeSector (u8 *buffer, u8 *crc_buf, u32 offset) {
|
||||||
#ifdef _NJSD_SYNC
|
#ifdef _NJSD_SYNC
|
||||||
REG_IME = old_REG_IME;
|
REG_IME = old_REG_IME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,12 +365,12 @@ static bool _NJSD_sendCLK (int speed, int count) {
|
||||||
REG_IME = 0;
|
REG_IME = 0;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
REG_IE &= ~0x100000;
|
REG_IE &= ~0x100000;
|
||||||
REG_IF = 0x100000;
|
REG_IF = 0x100000;
|
||||||
|
|
||||||
//CARD_CR1H = CARD_CR1_ENABLE; // | CARD_CR1_IRQ;
|
//CARD_CR1H = CARD_CR1_ENABLE; // | CARD_CR1_IRQ;
|
||||||
_NJSD_writeCardCommand (0xE0 | ((speed & 3) << 2), 0, (count - 1), 0, 0, 0, 0, 0);
|
_NJSD_writeCardCommand (0xE0 | ((speed & 3) << 2), 0, (count - 1), 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
CARD_CR2 = _NJSD_cardFlags;
|
CARD_CR2 = _NJSD_cardFlags;
|
||||||
i = COMMAND_TIMEOUT;
|
i = COMMAND_TIMEOUT;
|
||||||
while ((CARD_CR2 & CARD_BUSY) && --i);
|
while ((CARD_CR2 & CARD_BUSY) && --i);
|
||||||
|
@ -404,7 +404,7 @@ static bool _NJSD_sendCMDN (int speed, u8 cmd, u32 param) {
|
||||||
REG_IME = 0;
|
REG_IME = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
REG_IE &= ~0x100000;
|
REG_IE &= ~0x100000;
|
||||||
REG_IF = 0x100000;
|
REG_IF = 0x100000;
|
||||||
|
|
||||||
CARD_CR1H = CARD_CR1_ENABLE; // | CARD_CR1_IRQ;
|
CARD_CR1H = CARD_CR1_ENABLE; // | CARD_CR1_IRQ;
|
||||||
|
@ -438,22 +438,22 @@ static bool _NJSD_sendCMDN (int speed, u8 cmd, u32 param) {
|
||||||
static bool _NJSD_cardInit (void) {
|
static bool _NJSD_cardInit (void) {
|
||||||
u8 responseBuffer[17];
|
u8 responseBuffer[17];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// If the commands succeed the first time, assume they'll always succeed
|
// If the commands succeed the first time, assume they'll always succeed
|
||||||
if (! _NJSD_sendCLK (SD_CLK_200KHz, 256) ) return false;
|
if (! _NJSD_sendCLK (SD_CLK_200KHz, 256) ) return false;
|
||||||
if (! _NJSD_sendCMDN (SD_CLK_200KHz, GO_IDLE_STATE, 0) ) return false;
|
if (! _NJSD_sendCMDN (SD_CLK_200KHz, GO_IDLE_STATE, 0) ) return false;
|
||||||
_NJSD_sendCLK (SD_CLK_200KHz, 8);
|
_NJSD_sendCLK (SD_CLK_200KHz, 8);
|
||||||
|
|
||||||
_NJSD_sendCLK (SD_CLK_200KHz, 256);
|
_NJSD_sendCLK (SD_CLK_200KHz, 256);
|
||||||
_NJSD_sendCMDN (SD_CLK_200KHz, GO_IDLE_STATE, 0);
|
_NJSD_sendCMDN (SD_CLK_200KHz, GO_IDLE_STATE, 0);
|
||||||
_NJSD_sendCLK (SD_CLK_200KHz, 8);
|
_NJSD_sendCLK (SD_CLK_200KHz, 8);
|
||||||
|
|
||||||
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, APP_CMD, 0);
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, APP_CMD, 0);
|
||||||
if (
|
if (
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SD_APP_OP_COND, SD_OCR_VALUE) &&
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SD_APP_OP_COND, SD_OCR_VALUE) &&
|
||||||
((responseBuffer[1] & 0x80) != 0))
|
((responseBuffer[1] & 0x80) != 0))
|
||||||
{
|
{
|
||||||
// Card is ready to receive commands now
|
// Card is ready to receive commands now
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -461,10 +461,10 @@ static bool _NJSD_cardInit (void) {
|
||||||
if (i >= MAX_STARTUP_TRIES) {
|
if (i >= MAX_STARTUP_TRIES) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The card's name, as assigned by the manufacturer
|
// The card's name, as assigned by the manufacturer
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_136, ALL_SEND_CID, 0);
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_136, ALL_SEND_CID, 0);
|
||||||
|
|
||||||
// Get a new address
|
// Get a new address
|
||||||
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SEND_RELATIVE_ADDR, 0);
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SEND_RELATIVE_ADDR, 0);
|
||||||
|
@ -473,23 +473,23 @@ static bool _NJSD_cardInit (void) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i >= MAX_STARTUP_TRIES) {
|
if (i >= MAX_STARTUP_TRIES) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some cards won't go to higher speeds unless they think you checked their capabilities
|
// Some cards won't go to higher speeds unless they think you checked their capabilities
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_136, SEND_CSD, _NJSD_relativeCardAddress);
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_136, SEND_CSD, _NJSD_relativeCardAddress);
|
||||||
|
|
||||||
// Only this card should respond to all future commands
|
// Only this card should respond to all future commands
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SELECT_CARD, _NJSD_relativeCardAddress);
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SELECT_CARD, _NJSD_relativeCardAddress);
|
||||||
|
|
||||||
// Set a 4 bit data bus
|
// Set a 4 bit data bus
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, APP_CMD, _NJSD_relativeCardAddress);
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, APP_CMD, _NJSD_relativeCardAddress);
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SET_BUS_WIDTH, 2); // 4-bit mode.
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SET_BUS_WIDTH, 2); // 4-bit mode.
|
||||||
|
|
||||||
// Use 512 byte blocks
|
// Use 512 byte blocks
|
||||||
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SET_BLOCKLEN, 512); // 512 byte blocks
|
_NJSD_sendCMDR (SD_CLK_200KHz, responseBuffer, SD_RSP_48, SET_BLOCKLEN, 512); // 512 byte blocks
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,17 +521,17 @@ bool _NJSD_startup(void) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool _NJSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) {
|
bool _NJSD_writeSectors (u32 sector, u32 numSectors, const void* buffer) {
|
||||||
u8 crc[8];
|
u8 crc[8];
|
||||||
u32 offset = sector * BYTES_PER_READ;
|
u32 offset = sector * BYTES_PER_READ;
|
||||||
u8* data = (u8*) buffer;
|
u8* data = (u8*) buffer;
|
||||||
|
|
||||||
while (numSectors--) {
|
while (numSectors--) {
|
||||||
_SD_CRC16 ( data, BYTES_PER_READ, crc);
|
_SD_CRC16 ( data, BYTES_PER_READ, crc);
|
||||||
|
|
||||||
if (! _NJSD_writeSector (data, crc, offset)) {
|
if (! _NJSD_writeSector (data, crc, offset)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -549,7 +549,7 @@ bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
|
||||||
#ifdef _NJSD_SYNC
|
#ifdef _NJSD_SYNC
|
||||||
u32 old_REG_IME;
|
u32 old_REG_IME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u8* tbuf = (u8*)buffer;
|
u8* tbuf = (u8*)buffer;
|
||||||
|
|
||||||
if (numSectors == 0) {
|
if (numSectors == 0) {
|
||||||
|
@ -573,7 +573,7 @@ bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
|
||||||
if (!_NJSD_waitIRQ ()) {
|
if (!_NJSD_waitIRQ ()) {
|
||||||
#ifdef _NJSD_SYNC
|
#ifdef _NJSD_SYNC
|
||||||
REG_IME = old_REG_IME;
|
REG_IME = old_REG_IME;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -586,10 +586,10 @@ bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
|
||||||
if (!_NJSD_waitIRQ ()) {
|
if (!_NJSD_waitIRQ ()) {
|
||||||
#ifdef _NJSD_SYNC
|
#ifdef _NJSD_SYNC
|
||||||
REG_IME = old_REG_IME;
|
REG_IME = old_REG_IME;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((int)buffer & 0x03) != 0){
|
if (((int)buffer & 0x03) != 0){
|
||||||
cardPolledTransfer (0xA1406000, tmp, BYTES_PER_READ, (u8*)_NJSD_read_cmd);
|
cardPolledTransfer (0xA1406000, tmp, BYTES_PER_READ, (u8*)_NJSD_read_cmd);
|
||||||
memcpy (tbuf + (numSectors - 1) * BYTES_PER_READ, tmp, BYTES_PER_READ);
|
memcpy (tbuf + (numSectors - 1) * BYTES_PER_READ, tmp, BYTES_PER_READ);
|
||||||
|
@ -618,7 +618,7 @@ bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
|
||||||
#ifdef _NJSD_SYNC
|
#ifdef _NJSD_SYNC
|
||||||
u32 old_REG_IME;
|
u32 old_REG_IME;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
u8* tbuf = (u8*)buffer;
|
u8* tbuf = (u8*)buffer;
|
||||||
|
|
||||||
if (numSectors == 0) {
|
if (numSectors == 0) {
|
||||||
|
@ -637,7 +637,7 @@ bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
|
||||||
if (!_NJSD_waitIRQ ()) {
|
if (!_NJSD_waitIRQ ()) {
|
||||||
#ifdef _NJSD_SYNC
|
#ifdef _NJSD_SYNC
|
||||||
REG_IME = old_REG_IME;
|
REG_IME = old_REG_IME;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -645,10 +645,10 @@ bool _NJSD_readSectors (u32 sector, u32 numSectors, void* buffer) {
|
||||||
if (!_NJSD_waitIRQ ()) {
|
if (!_NJSD_waitIRQ ()) {
|
||||||
#ifdef _NJSD_SYNC
|
#ifdef _NJSD_SYNC
|
||||||
REG_IME = old_REG_IME;
|
REG_IME = old_REG_IME;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cardPolledTransfer (0xA1406000, (u32*)(tbuf + (numSectors - 1) * BYTES_PER_READ), BYTES_PER_READ, (u8*)_NJSD_read_cmd);
|
cardPolledTransfer (0xA1406000, (u32*)(tbuf + (numSectors - 1) * BYTES_PER_READ), BYTES_PER_READ, (u8*)_NJSD_read_cmd);
|
||||||
} else {
|
} else {
|
||||||
_NJSD_sendCMDR (_NJSD_speed, NULL, SD_RSP_STREAM, READ_SINGLE_BLOCK, sector * BYTES_PER_READ);
|
_NJSD_sendCMDR (_NJSD_speed, NULL, SD_RSP_STREAM, READ_SINGLE_BLOCK, sector * BYTES_PER_READ);
|
||||||
|
@ -678,4 +678,4 @@ LPIO_INTERFACE NJSD_GetInterface(void) {
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#endif // defined NDS
|
#endif // defined NDS
|
||||||
#endif
|
#endif
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
io_njsd.h
|
io_njsd.h
|
||||||
|
|
||||||
Hardware Routines for reading an SD card using
|
Hardware Routines for reading an SD card using
|
||||||
a NinjaDS SD adapter.
|
a NinjaDS SD adapter.
|
||||||
|
|
||||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
are permitted provided that the following conditions are met:
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
project at chishm@hotmail.com
|
project at chishm@hotmail.com
|
||||||
|
|
||||||
See gba_nds_fat.txt for help and license details.
|
See gba_nds_fat.txt for help and license details.
|
||||||
|
|
||||||
2006-02-09 - www.neoflash.com:
|
2006-02-09 - www.neoflash.com:
|
||||||
* First stable release
|
* First stable release
|
||||||
|
|
||||||
2006-02-13 - Chishm
|
2006-02-13 - Chishm
|
||||||
* Added ReadMK2Config function
|
* Added ReadMK2Config function
|
||||||
* Added read config test to init function so no unnecessary card commands are sent
|
* Added read config test to init function so no unnecessary card commands are sent
|
||||||
|
@ -73,7 +73,7 @@ static inline void Neo_MK2GameMode() {
|
||||||
static inline void Neo_EnableEEPROM( bool enable ) {
|
static inline void Neo_EnableEEPROM( bool enable ) {
|
||||||
Neo_OpenSPI(spi_freq);
|
Neo_OpenSPI(spi_freq);
|
||||||
if(enable) Neo_SPI(0x06);
|
if(enable) Neo_SPI(0x06);
|
||||||
else Neo_SPI(0x0E);
|
else Neo_SPI(0x0E);
|
||||||
Neo_CloseSPI();
|
Neo_CloseSPI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void Neo_WriteMK2Config(u8 config) {
|
||||||
Neo_EnableEEPROM(false);
|
Neo_EnableEEPROM(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 Neo_ReadMK2Config(void)
|
u8 Neo_ReadMK2Config(void)
|
||||||
{
|
{
|
||||||
u8 config;
|
u8 config;
|
||||||
Neo_EnableEEPROM(true);
|
Neo_EnableEEPROM(true);
|
||||||
|
@ -104,7 +104,7 @@ u8 Neo_ReadMK2Config(void)
|
||||||
|
|
||||||
u8 selectMMC_command [8] = {0xFF, 0x00, 0x6A, 0xDF, 0x37, 0x59, 0x33, 0xA3};
|
u8 selectMMC_command [8] = {0xFF, 0x00, 0x6A, 0xDF, 0x37, 0x59, 0x33, 0xA3};
|
||||||
|
|
||||||
void Neo_SelectMMC (u8 dataByte)
|
void Neo_SelectMMC (u8 dataByte)
|
||||||
{
|
{
|
||||||
selectMMC_command[1] = dataByte; // Set enable / disable byte
|
selectMMC_command[1] = dataByte; // Set enable / disable byte
|
||||||
cardWriteCommand (selectMMC_command); // Send "5. Use the EEPROM CS to access the MK2 MMC/SD card"
|
cardWriteCommand (selectMMC_command); // Send "5. Use the EEPROM CS to access the MK2 MMC/SD card"
|
||||||
|
@ -154,12 +154,12 @@ bool Neo_CheckMMCResponse( u8 response, u8 mask ) {
|
||||||
bool Neo_InitMMC() {
|
bool Neo_InitMMC() {
|
||||||
Neo_MK2GameMode();
|
Neo_MK2GameMode();
|
||||||
Neo_WriteMK2Config( MK2_CONFIG_ZIP_RAM_CLOSE | MK2_CONFIG_GAME_FLASH_CLOSE);
|
Neo_WriteMK2Config( MK2_CONFIG_ZIP_RAM_CLOSE | MK2_CONFIG_GAME_FLASH_CLOSE);
|
||||||
|
|
||||||
// Make sure the configuration was accepted
|
// Make sure the configuration was accepted
|
||||||
if (Neo_ReadMK2Config() != (MK2_CONFIG_ZIP_RAM_CLOSE | MK2_CONFIG_GAME_FLASH_CLOSE)) {
|
if (Neo_ReadMK2Config() != (MK2_CONFIG_ZIP_RAM_CLOSE | MK2_CONFIG_GAME_FLASH_CLOSE)) {
|
||||||
return false; // If not, then it wasn't initialised properly
|
return false; // If not, then it wasn't initialised properly
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ bool Neo_InitMMC() {
|
||||||
|
|
||||||
bool NMMC_IsInserted(void) {
|
bool NMMC_IsInserted(void) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
||||||
Neo_SendMMCCommand(MMC_SEND_CSD, 0);
|
Neo_SendMMCCommand(MMC_SEND_CSD, 0);
|
||||||
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
||||||
|
@ -183,13 +183,13 @@ bool NMMC_IsInserted(void) {
|
||||||
for (i = 0; i < 28; i++) {
|
for (i = 0; i < 28; i++) {
|
||||||
Neo_SPI(0xff);
|
Neo_SPI(0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NMMC_ClearStatus (void) {
|
bool NMMC_ClearStatus (void) {
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
Neo_SPI(0xFF); // Send 10 0xFF bytes to MMC card
|
Neo_SPI(0xFF); // Send 10 0xFF bytes to MMC card
|
||||||
|
@ -224,14 +224,14 @@ bool NMMC_StartUp(void) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
||||||
|
|
||||||
// Set block length
|
// Set block length
|
||||||
Neo_SendMMCCommand(MMC_SET_BLOCKLEN, BYTE_PER_READ );
|
Neo_SendMMCCommand(MMC_SET_BLOCKLEN, BYTE_PER_READ );
|
||||||
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
||||||
Neo_EnableMMC( false );
|
Neo_EnableMMC( false );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we can use a higher SPI frequency
|
// Check if we can use a higher SPI frequency
|
||||||
Neo_SendMMCCommand(MMC_SEND_CSD, 0);
|
Neo_SendMMCCommand(MMC_SEND_CSD, 0);
|
||||||
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
||||||
|
@ -252,77 +252,77 @@ bool NMMC_StartUp(void) {
|
||||||
if ((transSpeed & 0xf0) >= 0x30) {
|
if ((transSpeed & 0xf0) >= 0x30) {
|
||||||
spi_freq = 0;
|
spi_freq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Neo_EnableMMC( false );
|
Neo_EnableMMC( false );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool NMMC_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
bool NMMC_WriteSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u8 *p=buffer;
|
u8 *p=buffer;
|
||||||
|
|
||||||
int totalSecs = (numSecs == 0) ? 256 : numSecs;
|
int totalSecs = (numSecs == 0) ? 256 : numSecs;
|
||||||
sector *= BYTE_PER_READ;
|
sector *= BYTE_PER_READ;
|
||||||
|
|
||||||
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
||||||
Neo_SendMMCCommand( 25, sector );
|
Neo_SendMMCCommand( 25, sector );
|
||||||
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
||||||
Neo_EnableMMC( false );
|
Neo_EnableMMC( false );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (totalSecs--) {
|
while (totalSecs--) {
|
||||||
Neo_SPI( 0xFC ); // Send Start Block token
|
Neo_SPI( 0xFC ); // Send Start Block token
|
||||||
for( i = 0; i < BYTE_PER_READ; i++ ) // Send a block of data
|
for( i = 0; i < BYTE_PER_READ; i++ ) // Send a block of data
|
||||||
Neo_SPI( *p++ );
|
Neo_SPI( *p++ );
|
||||||
Neo_SPI( 0xFF ); // Send fake CRC16
|
Neo_SPI( 0xFF ); // Send fake CRC16
|
||||||
Neo_SPI( 0xFF ); // Send fake CRC16
|
Neo_SPI( 0xFF ); // Send fake CRC16
|
||||||
|
|
||||||
if( ( Neo_SPI( 0xFF ) & 0x0F ) != 0x05 ) { // Make sure the block was accepted
|
if( ( Neo_SPI( 0xFF ) & 0x0F ) != 0x05 ) { // Make sure the block was accepted
|
||||||
Neo_EnableMMC( false );
|
Neo_EnableMMC( false );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
while( Neo_SPI( 0xFF ) == 0x00 ); // Wait for the block to be written
|
while( Neo_SPI( 0xFF ) == 0x00 ); // Wait for the block to be written
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop transmission block
|
// Stop transmission block
|
||||||
Neo_SPI( 0xFD ); // Send Stop Transmission Block token
|
Neo_SPI( 0xFD ); // Send Stop Transmission Block token
|
||||||
for( i = 0; i < BYTE_PER_READ; i++ ) // Send a block of fake data
|
for( i = 0; i < BYTE_PER_READ; i++ ) // Send a block of fake data
|
||||||
Neo_SPI( 0xFF );
|
Neo_SPI( 0xFF );
|
||||||
Neo_SPI( 0xFF ); // Send fake CRC16
|
Neo_SPI( 0xFF ); // Send fake CRC16
|
||||||
Neo_SPI( 0xFF ); // Send fake CRC16
|
Neo_SPI( 0xFF ); // Send fake CRC16
|
||||||
|
|
||||||
Neo_SPI (0xFF); // Send 8 clocks
|
Neo_SPI (0xFF); // Send 8 clocks
|
||||||
while( Neo_SPI( 0xFF ) == 0x00 ); // Wait for the busy signal to clear
|
while( Neo_SPI( 0xFF ) == 0x00 ); // Wait for the busy signal to clear
|
||||||
|
|
||||||
|
|
||||||
for ( i = 0; i < 0x10; i++) {
|
for ( i = 0; i < 0x10; i++) {
|
||||||
Neo_SPI (0xFF); // Send clocks for the MMC card to finish what it's doing
|
Neo_SPI (0xFF); // Send clocks for the MMC card to finish what it's doing
|
||||||
}
|
}
|
||||||
|
|
||||||
Neo_EnableMMC( false ); // Close SPI port to MMC card
|
Neo_EnableMMC( false ); // Close SPI port to MMC card
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NMMC_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
bool NMMC_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u8 *p=buffer;
|
u8 *p=buffer;
|
||||||
|
|
||||||
int totalSecs = (numSecs == 0) ? 256 : numSecs;
|
int totalSecs = (numSecs == 0) ? 256 : numSecs;
|
||||||
sector *= BYTE_PER_READ;
|
sector *= BYTE_PER_READ;
|
||||||
|
|
||||||
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
Neo_EnableMMC( true ); // Open SPI port to MMC card
|
||||||
|
|
||||||
while (totalSecs--) {
|
while (totalSecs--) {
|
||||||
Neo_SendMMCCommand(MMC_READ_BLOCK, sector );
|
Neo_SendMMCCommand(MMC_READ_BLOCK, sector );
|
||||||
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
if( Neo_CheckMMCResponse( 0x00, 0xFF ) == false ) { // Make sure no errors occured
|
||||||
Neo_EnableMMC( false );
|
Neo_EnableMMC( false );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Neo_CheckMMCResponse( 0xFE, 0xFF ) == false ) { // Check for Start Block token
|
if( Neo_CheckMMCResponse( 0xFE, 0xFF ) == false ) { // Check for Start Block token
|
||||||
Neo_EnableMMC( false );
|
Neo_EnableMMC( false );
|
||||||
return false;
|
return false;
|
||||||
|
@ -333,7 +333,7 @@ bool NMMC_ReadSectors (u32 sector, u8 numSecs, void* buffer)
|
||||||
Neo_SPI( 0xFF ); // Ignore CRC16
|
Neo_SPI( 0xFF ); // Ignore CRC16
|
||||||
sector += BYTE_PER_READ;
|
sector += BYTE_PER_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
Neo_EnableMMC( false ); // Close SPI port to MMC card
|
Neo_EnableMMC( false ); // Close SPI port to MMC card
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
io_NMMC.h
|
io_NMMC.h
|
||||||
|
|
||||||
Hardware Routines for reading an SD or MMC card using
|
Hardware Routines for reading an SD or MMC card using
|
||||||
a Neoflash MK2 or MK3.
|
a Neoflash MK2 or MK3.
|
||||||
|
@ -26,7 +26,7 @@ extern LPIO_INTERFACE NMMC_GetInterface(void) ;
|
||||||
|
|
||||||
#endif // define IO_NMMC_H
|
#endif // define IO_NMMC_H
|
||||||
/*
|
/*
|
||||||
io_NMMC.h
|
io_NMMC.h
|
||||||
|
|
||||||
Hardware Routines for reading an SD or MMC card using
|
Hardware Routines for reading an SD or MMC card using
|
||||||
a Neoflash MK2 or MK3.
|
a Neoflash MK2 or MK3.
|
||||||
|
|
|
@ -57,7 +57,7 @@ bool SCCF_Unlock(void)
|
||||||
temp = (~temp & 0xFF);
|
temp = (~temp & 0xFF);
|
||||||
return (CF_REG_LBA1 == temp);
|
return (CF_REG_LBA1 == temp);
|
||||||
#undef CF_REG_LBA1
|
#undef CF_REG_LBA1
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SCCF_Shutdown(void) {
|
bool SCCF_Shutdown(void) {
|
||||||
return MPCF_ClearStatus() ;
|
return MPCF_ClearStatus() ;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
io_sccf.h
|
io_sccf.h
|
||||||
|
|
||||||
Hardware Routines for reading a compact flash card
|
Hardware Routines for reading a compact flash card
|
||||||
using the Supercard CF
|
using the Supercard CF
|
||||||
|
@ -24,7 +24,7 @@ extern LPIO_INTERFACE SCCF_GetInterface(void) ;
|
||||||
|
|
||||||
#endif // define IO_SCCF_H
|
#endif // define IO_SCCF_H
|
||||||
/*
|
/*
|
||||||
io_sccf.h
|
io_sccf.h
|
||||||
|
|
||||||
Hardware Routines for reading a compact flash card
|
Hardware Routines for reading a compact flash card
|
||||||
using the Supercard CF
|
using the Supercard CF
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
io_scsd.c by SaTa.
|
io_scsd.c by SaTa.
|
||||||
based on io_sccf.c
|
based on io_sccf.c
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,7 +43,7 @@ extern void InitSCMode(void); // CF
|
||||||
extern void ReadSector(u16 *buff,u32 sector,u8 ReadNumber);
|
extern void ReadSector(u16 *buff,u32 sector,u8 ReadNumber);
|
||||||
extern void WriteSector(u16 *buff,u32 sector,u8 writeNumber);
|
extern void WriteSector(u16 *buff,u32 sector,u8 writeNumber);
|
||||||
extern bool MemoryCard_IsInserted(void); // CF‚ƈႤ
|
extern bool MemoryCard_IsInserted(void); // CF‚ƈႤ
|
||||||
//
|
//
|
||||||
|
|
||||||
/*-----------------------------------------------------------------
|
/*-----------------------------------------------------------------
|
||||||
SCSD_Unlock
|
SCSD_Unlock
|
||||||
|
@ -55,7 +55,7 @@ bool SCSD_Unlock(void)
|
||||||
{
|
{
|
||||||
InitSCMode();
|
InitSCMode();
|
||||||
return MemoryCard_IsInserted();
|
return MemoryCard_IsInserted();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SCSD_Shutdown(void) {
|
bool SCSD_Shutdown(void) {
|
||||||
return MPCF_ClearStatus() ;
|
return MPCF_ClearStatus() ;
|
||||||
|
@ -103,4 +103,4 @@ LPIO_INTERFACE SCSD_GetInterface(void) {
|
||||||
return &io_scsd ;
|
return &io_scsd ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -1,12 +1,12 @@
|
||||||
/*
|
/*
|
||||||
io_scsd.h by SaTa.
|
io_scsd.h by SaTa.
|
||||||
based on io_sccf.h
|
based on io_sccf.h
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
io_sccf.h
|
io_sccf.h
|
||||||
|
|
||||||
Hardware Routines for reading a compact flash card
|
Hardware Routines for reading a compact flash card
|
||||||
using the GBA Movie Player
|
using the GBA Movie Player
|
||||||
|
@ -26,4 +26,4 @@
|
||||||
// export interface
|
// export interface
|
||||||
extern LPIO_INTERFACE SCSD_GetInterface(void) ;
|
extern LPIO_INTERFACE SCSD_GetInterface(void) ;
|
||||||
|
|
||||||
#endif // define IO_SCSD_H
|
#endif // define IO_SCSD_H
|
|
@ -1,22 +1,22 @@
|
||||||
.TEXT
|
.TEXT
|
||||||
@--------------------------------sd data--------------------------------
|
@--------------------------------sd data--------------------------------
|
||||||
.equ sd_comadd,0x9800000
|
.equ sd_comadd,0x9800000
|
||||||
.equ sd_dataadd,0x9000000
|
.equ sd_dataadd,0x9000000
|
||||||
.equ sd_dataradd,0x9100000
|
.equ sd_dataradd,0x9100000
|
||||||
@-----------------viod sd_data_write_s(u16 *buff,u16* crc16buff)-------------------
|
@-----------------viod sd_data_write_s(u16 *buff,u16* crc16buff)-------------------
|
||||||
.ALIGN
|
.ALIGN
|
||||||
.GLOBAL sd_data_write_s
|
.GLOBAL sd_data_write_s
|
||||||
.CODE 32
|
.CODE 32
|
||||||
sd_data_write_s:
|
sd_data_write_s:
|
||||||
stmfd r13!,{r4-r5}
|
stmfd r13!,{r4-r5}
|
||||||
mov r5,#512
|
mov r5,#512
|
||||||
mov r2,#sd_dataadd
|
mov r2,#sd_dataadd
|
||||||
sd_data_write_busy:
|
sd_data_write_busy:
|
||||||
ldrh r3,[r2]
|
ldrh r3,[r2]
|
||||||
tst r3,#0x100
|
tst r3,#0x100
|
||||||
beq sd_data_write_busy
|
beq sd_data_write_busy
|
||||||
|
|
||||||
ldrh r3,[r2]
|
ldrh r3,[r2]
|
||||||
|
|
||||||
mov r3,#0 @star bit
|
mov r3,#0 @star bit
|
||||||
strh r3,[r2]
|
strh r3,[r2]
|
||||||
|
@ -24,10 +24,10 @@ sd_data_write_loop:
|
||||||
ldrh r3,[r0],#2
|
ldrh r3,[r0],#2
|
||||||
add r3,r3,r3,lsl #20
|
add r3,r3,r3,lsl #20
|
||||||
mov r4,r3,lsl #8
|
mov r4,r3,lsl #8
|
||||||
stmia r2,{r3-r4}
|
stmia r2,{r3-r4}
|
||||||
|
|
||||||
subs r5, r5, #2
|
subs r5, r5, #2
|
||||||
bne sd_data_write_loop
|
bne sd_data_write_loop
|
||||||
|
|
||||||
cmp r1,#0
|
cmp r1,#0
|
||||||
movne r0,r1
|
movne r0,r1
|
||||||
|
@ -38,11 +38,11 @@ sd_data_write_loop:
|
||||||
mov r3,#0xff @end bit
|
mov r3,#0xff @end bit
|
||||||
strh r3,[r2]
|
strh r3,[r2]
|
||||||
sd_data_write_loop2:
|
sd_data_write_loop2:
|
||||||
ldrh r3,[r2]
|
ldrh r3,[r2]
|
||||||
tst r3,#0x100
|
tst r3,#0x100
|
||||||
bne sd_data_write_loop2
|
bne sd_data_write_loop2
|
||||||
|
|
||||||
ldmia r2,{r3-r4}
|
ldmia r2,{r3-r4}
|
||||||
|
|
||||||
ldmfd r13!,{r4-r5}
|
ldmfd r13!,{r4-r5}
|
||||||
bx r14
|
bx r14
|
||||||
|
@ -50,7 +50,7 @@ sd_data_write_loop2:
|
||||||
|
|
||||||
@----------void sd_data_read_s(u16 *buff)-------------
|
@----------void sd_data_read_s(u16 *buff)-------------
|
||||||
.ALIGN
|
.ALIGN
|
||||||
.GLOBAL sd_data_read_s
|
.GLOBAL sd_data_read_s
|
||||||
.CODE 32
|
.CODE 32
|
||||||
sd_data_read_s:
|
sd_data_read_s:
|
||||||
stmfd r13!,{r4}
|
stmfd r13!,{r4}
|
||||||
|
@ -61,62 +61,62 @@ sd_data_read_loop1:
|
||||||
bne sd_data_read_loop1
|
bne sd_data_read_loop1
|
||||||
mov r2,#512
|
mov r2,#512
|
||||||
sd_data_read_loop:
|
sd_data_read_loop:
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
mov r3,r4,lsr #16
|
mov r3,r4,lsr #16
|
||||||
strh r3 ,[r0],#2
|
strh r3 ,[r0],#2
|
||||||
|
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
mov r3,r4,lsr #16
|
mov r3,r4,lsr #16
|
||||||
strh r3 ,[r0],#2
|
strh r3 ,[r0],#2
|
||||||
|
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
mov r3,r4,lsr #16
|
mov r3,r4,lsr #16
|
||||||
strh r3 ,[r0],#2
|
strh r3 ,[r0],#2
|
||||||
|
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
mov r3,r4,lsr #16
|
mov r3,r4,lsr #16
|
||||||
strh r3 ,[r0],#2
|
strh r3 ,[r0],#2
|
||||||
|
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
mov r3,r4,lsr #16
|
mov r3,r4,lsr #16
|
||||||
strh r3 ,[r0],#2
|
strh r3 ,[r0],#2
|
||||||
|
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
mov r3,r4,lsr #16
|
mov r3,r4,lsr #16
|
||||||
strh r3 ,[r0],#2
|
strh r3 ,[r0],#2
|
||||||
|
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
mov r3,r4,lsr #16
|
mov r3,r4,lsr #16
|
||||||
strh r3 ,[r0],#2
|
strh r3 ,[r0],#2
|
||||||
|
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
mov r3,r4,lsr #16
|
mov r3,r4,lsr #16
|
||||||
strh r3 ,[r0],#2
|
strh r3 ,[r0],#2
|
||||||
|
|
||||||
subs r2, r2, #16
|
subs r2, r2, #16
|
||||||
bne sd_data_read_loop
|
bne sd_data_read_loop
|
||||||
|
|
||||||
ldmia r1,{r3-r4} @crc 16
|
ldmia r1,{r3-r4} @crc 16
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
ldmia r1,{r3-r4}
|
ldmia r1,{r3-r4}
|
||||||
ldrh r3,[r1] @end bit
|
ldrh r3,[r1] @end bit
|
||||||
ldmfd r13!,{r4}
|
ldmfd r13!,{r4}
|
||||||
bx r14
|
bx r14
|
||||||
@----------end sd_data_read_s-------------
|
@----------end sd_data_read_s-------------
|
||||||
|
|
||||||
@------void sd_com_crc16_s(u16* buff,u16 num,u16* crc16buff)
|
@------void sd_com_crc16_s(u16* buff,u16 num,u16* crc16buff)
|
||||||
.ALIGN
|
.ALIGN
|
||||||
.GLOBAL sd_crc16_s
|
.GLOBAL sd_crc16_s
|
||||||
.CODE 32
|
.CODE 32
|
||||||
sd_crc16_s:
|
sd_crc16_s:
|
||||||
stmfd r13!,{r4-r9}
|
stmfd r13!,{r4-r9}
|
||||||
mov r9,r2
|
mov r9,r2
|
||||||
|
|
||||||
mov r3,#0
|
mov r3,#0
|
||||||
mov r4,#0
|
mov r4,#0
|
||||||
mov r5,#0
|
mov r5,#0
|
||||||
mov r6,#0
|
mov r6,#0
|
||||||
|
|
||||||
ldr r7,=0x80808080
|
ldr r7,=0x80808080
|
||||||
ldr r8,=0x1021
|
ldr r8,=0x1021
|
||||||
|
@ -131,19 +131,19 @@ sd_crc16_loop:
|
||||||
eorne r3,r3,r8
|
eorne r3,r3,r8
|
||||||
tst r2,r7,lsr #24
|
tst r2,r7,lsr #24
|
||||||
eorne r3,r3,r8
|
eorne r3,r3,r8
|
||||||
|
|
||||||
mov r4,r4,lsl #1
|
mov r4,r4,lsl #1
|
||||||
tst r4,#0x10000
|
tst r4,#0x10000
|
||||||
eorne r4,r4,r8
|
eorne r4,r4,r8
|
||||||
tst r2,r7,lsr #25
|
tst r2,r7,lsr #25
|
||||||
eorne r4,r4,r8
|
eorne r4,r4,r8
|
||||||
|
|
||||||
mov r5,r5,lsl #1
|
mov r5,r5,lsl #1
|
||||||
tst r5,#0x10000
|
tst r5,#0x10000
|
||||||
eorne r5,r5,r8
|
eorne r5,r5,r8
|
||||||
tst r2,r7,lsr #26
|
tst r2,r7,lsr #26
|
||||||
eorne r5,r5,r8
|
eorne r5,r5,r8
|
||||||
|
|
||||||
mov r6,r6,lsl #1
|
mov r6,r6,lsl #1
|
||||||
tst r6,#0x10000
|
tst r6,#0x10000
|
||||||
eorne r6,r6,r8
|
eorne r6,r6,r8
|
||||||
|
@ -152,7 +152,7 @@ sd_crc16_loop:
|
||||||
|
|
||||||
mov r7,r7,ror #4
|
mov r7,r7,ror #4
|
||||||
subs r1,r1,#4
|
subs r1,r1,#4
|
||||||
bne sd_crc16_loop
|
bne sd_crc16_loop
|
||||||
|
|
||||||
mov r2,r9
|
mov r2,r9
|
||||||
mov r8,#16
|
mov r8,#16
|
||||||
|
@ -184,7 +184,7 @@ sd_crc16_write_data:
|
||||||
|
|
||||||
@--------------u8 sd_crc7_s(u16* buff,u16 num)----------------------------
|
@--------------u8 sd_crc7_s(u16* buff,u16 num)----------------------------
|
||||||
.ALIGN
|
.ALIGN
|
||||||
.GLOBAL sd_crc7_s
|
.GLOBAL sd_crc7_s
|
||||||
.CODE 32
|
.CODE 32
|
||||||
sd_crc7_s:
|
sd_crc7_s:
|
||||||
stmfd r13!,{r4}
|
stmfd r13!,{r4}
|
||||||
|
@ -206,7 +206,7 @@ sd_crc7_loop:
|
||||||
|
|
||||||
mov r4,r4,ror #1
|
mov r4,r4,ror #1
|
||||||
subs r1,r1,#1
|
subs r1,r1,#1
|
||||||
bne sd_crc7_loop
|
bne sd_crc7_loop
|
||||||
|
|
||||||
mov r3,r3,lsl #1
|
mov r3,r3,lsl #1
|
||||||
add r0,r3,#1
|
add r0,r3,#1
|
||||||
|
@ -216,7 +216,7 @@ sd_crc7_loop:
|
||||||
|
|
||||||
@--------------sd_com_read_s(u16* buff,u32 num)------------------
|
@--------------sd_com_read_s(u16* buff,u32 num)------------------
|
||||||
.ALIGN
|
.ALIGN
|
||||||
.GLOBAL sd_com_read_s
|
.GLOBAL sd_com_read_s
|
||||||
.CODE 32
|
.CODE 32
|
||||||
|
|
||||||
sd_com_read_s:
|
sd_com_read_s:
|
||||||
|
@ -229,8 +229,8 @@ sd_com_read_loop1:
|
||||||
|
|
||||||
sd_com_read_loop:
|
sd_com_read_loop:
|
||||||
ldmia r2,{r3-r6}
|
ldmia r2,{r3-r6}
|
||||||
subs r1, r1, #1
|
subs r1, r1, #1
|
||||||
bne sd_com_read_loop
|
bne sd_com_read_loop
|
||||||
ldmfd r13!,{r4-r6}
|
ldmfd r13!,{r4-r6}
|
||||||
bx r14
|
bx r14
|
||||||
@--------------end sd_com_read_s------------------
|
@--------------end sd_com_read_s------------------
|
||||||
|
@ -242,14 +242,14 @@ sd_com_read_loop:
|
||||||
.CODE 32
|
.CODE 32
|
||||||
sd_com_write_s:
|
sd_com_write_s:
|
||||||
stmfd r13!,{r4-r6}
|
stmfd r13!,{r4-r6}
|
||||||
|
|
||||||
mov r2,#sd_comadd
|
mov r2,#sd_comadd
|
||||||
sd_com_write_busy:
|
sd_com_write_busy:
|
||||||
ldrh r3,[r2]
|
ldrh r3,[r2]
|
||||||
tst r3,#0x1
|
tst r3,#0x1
|
||||||
beq sd_com_write_busy
|
beq sd_com_write_busy
|
||||||
|
|
||||||
ldrh r3,[r2]
|
ldrh r3,[r2]
|
||||||
|
|
||||||
sd_com_write_loop:
|
sd_com_write_loop:
|
||||||
ldrb r3,[r0],#1
|
ldrb r3,[r0],#1
|
||||||
|
@ -257,9 +257,9 @@ sd_com_write_loop:
|
||||||
mov r4,r3,lsl #2
|
mov r4,r3,lsl #2
|
||||||
mov r5,r4,lsl #2
|
mov r5,r4,lsl #2
|
||||||
mov r6,r5,lsl #2
|
mov r6,r5,lsl #2
|
||||||
stmia r2,{r3-r6}
|
stmia r2,{r3-r6}
|
||||||
subs r1, r1, #1
|
subs r1, r1, #1
|
||||||
bne sd_com_write_loop
|
bne sd_com_write_loop
|
||||||
ldmfd r13!,{r4-r6}
|
ldmfd r13!,{r4-r6}
|
||||||
|
|
||||||
bx r14
|
bx r14
|
||||||
|
@ -267,7 +267,7 @@ sd_com_write_loop:
|
||||||
|
|
||||||
@-----------------void send_clk(u32 num)---------
|
@-----------------void send_clk(u32 num)---------
|
||||||
.ALIGN
|
.ALIGN
|
||||||
.GLOBAL send_clk
|
.GLOBAL send_clk
|
||||||
.CODE 32
|
.CODE 32
|
||||||
|
|
||||||
send_clk:
|
send_clk:
|
||||||
|
@ -281,7 +281,7 @@ send_clk_loop1:
|
||||||
|
|
||||||
@---------------------------void SDCommand(u8 command,u8 num,u32 sector)--------------------
|
@---------------------------void SDCommand(u8 command,u8 num,u32 sector)--------------------
|
||||||
.ALIGN
|
.ALIGN
|
||||||
.GLOBAL SDCommand
|
.GLOBAL SDCommand
|
||||||
.CODE 32
|
.CODE 32
|
||||||
@void SDCommand(u8 command,u8 num,u32 sector )
|
@void SDCommand(u8 command,u8 num,u32 sector )
|
||||||
@{
|
@{
|
||||||
|
@ -338,12 +338,12 @@ SDCommand:
|
||||||
@ register u16 i,j;
|
@ register u16 i,j;
|
||||||
@ i=readnum;
|
@ i=readnum;
|
||||||
@ sectno<<=9;
|
@ sectno<<=9;
|
||||||
@ SDCommand(18,0,sector);
|
@ SDCommand(18,0,sector);
|
||||||
@ for (j=0;j<i ; j++)
|
@ for (j=0;j<i ; j++)
|
||||||
@ {
|
@ {
|
||||||
@ sd_data_read_s((u32)buff+j*512);
|
@ sd_data_read_s((u32)buff+j*512);
|
||||||
@ }
|
@ }
|
||||||
@ SDCommand(12,0,0);
|
@ SDCommand(12,0,0);
|
||||||
@ get_resp();
|
@ get_resp();
|
||||||
@ send_clk(0x10);
|
@ send_clk(0x10);
|
||||||
@
|
@
|
||||||
|
@ -363,7 +363,7 @@ beginforj_ReadSector:
|
||||||
cmp r6,r5
|
cmp r6,r5
|
||||||
bge endforj_ReadSector
|
bge endforj_ReadSector
|
||||||
mov r0,r4
|
mov r0,r4
|
||||||
add r0,r0,r6,lsl #9
|
add r0,r0,r6,lsl #9
|
||||||
bl sd_data_read_s
|
bl sd_data_read_s
|
||||||
add r6,r6,#1
|
add r6,r6,#1
|
||||||
b beginforj_ReadSector
|
b beginforj_ReadSector
|
||||||
|
@ -408,17 +408,17 @@ get_resp:
|
||||||
@
|
@
|
||||||
@ sectno<<=9;
|
@ sectno<<=9;
|
||||||
@
|
@
|
||||||
@ SDCommand(25,0,sector);
|
@ SDCommand(25,0,sector);
|
||||||
@ get_resp();
|
@ get_resp();
|
||||||
@ send_clk(0x10);
|
@ send_clk(0x10);
|
||||||
@
|
@
|
||||||
@ for (j=0;j<i ; j++)
|
@ for (j=0;j<i ; j++)
|
||||||
@ {
|
@ {
|
||||||
@ sd_crc16_s((u32)(u32)buff+j*512,512,(u32)crc16);
|
@ sd_crc16_s((u32)(u32)buff+j*512,512,(u32)crc16);
|
||||||
@ sd_data_write_s((u32)buff+j*512,(u32)crc16);
|
@ sd_data_write_s((u32)buff+j*512,(u32)crc16);
|
||||||
@ send_clk(0x10);
|
@ send_clk(0x10);
|
||||||
@ }
|
@ }
|
||||||
@ SDCommand(12,0,0);
|
@ SDCommand(12,0,0);
|
||||||
@ get_resp();
|
@ get_resp();
|
||||||
@ send_clk(0x10);
|
@ send_clk(0x10);
|
||||||
@ while((*(u16*)sd_dataadd &0x0100)==0);
|
@ while((*(u16*)sd_dataadd &0x0100)==0);
|
||||||
|
@ -451,7 +451,7 @@ beginforj_WriteSector:
|
||||||
add r2,r13,#4
|
add r2,r13,#4
|
||||||
bl sd_crc16_s
|
bl sd_crc16_s
|
||||||
mov r0,r4
|
mov r0,r4
|
||||||
add r0,r0,r6,lsl #9
|
add r0,r0,r6,lsl #9
|
||||||
add r1,r13,#4
|
add r1,r13,#4
|
||||||
bl sd_data_write_s
|
bl sd_data_write_s
|
||||||
mov r0,#0x10
|
mov r0,#0x10
|
||||||
|
@ -481,7 +481,7 @@ beginwhile_WriteSector:
|
||||||
.GLOBAL InitSCMode
|
.GLOBAL InitSCMode
|
||||||
.CODE 32
|
.CODE 32
|
||||||
InitSCMode:
|
InitSCMode:
|
||||||
mvn r0,#0x0F6000000
|
mvn r0,#0x0F6000000
|
||||||
sub r0,r0,#0x01
|
sub r0,r0,#0x01
|
||||||
mov r1,#0x0A500
|
mov r1,#0x0A500
|
||||||
add r1,r1,#0x5A
|
add r1,r1,#0x5A
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
|
|
||||||
Common SD card routines
|
Common SD card routines
|
||||||
|
|
||||||
SD routines partially based on sd.s by Romman
|
SD routines partially based on sd.s by Romman
|
||||||
|
|
||||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
are permitted provided that the following conditions are met:
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
2006-08-07 - Chishm
|
2006-08-07 - Chishm
|
||||||
* Moved the SD initialization to a common function
|
* Moved the SD initialization to a common function
|
||||||
* Increased timeouts for slower cards
|
* Increased timeouts for slower cards
|
||||||
|
@ -61,10 +61,10 @@ u8 _SD_CRC7(u8* data, int cnt) {
|
||||||
}
|
}
|
||||||
crc = (crc << 1) | 1;
|
crc = (crc << 1) | 1;
|
||||||
return(crc);
|
return(crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calculates the CRC16 for a sector of data. Calculates it
|
Calculates the CRC16 for a sector of data. Calculates it
|
||||||
as 4 separate lots, merged into one buffer. This is used
|
as 4 separate lots, merged into one buffer. This is used
|
||||||
for 4 SD data lines, not for 1 data line alone.
|
for 4 SD data lines, not for 1 data line alone.
|
||||||
*/
|
*/
|
||||||
|
@ -79,53 +79,53 @@ void _SD_CRC16 (u8* buff, int buffLength, u8* crc16buff) {
|
||||||
b = 0; // r4
|
b = 0; // r4
|
||||||
c = 0; // r5
|
c = 0; // r5
|
||||||
d = 0; // r6
|
d = 0; // r6
|
||||||
|
|
||||||
buffLength = buffLength * 8;
|
buffLength = buffLength * 8;
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (bitPattern & 0x80) dataByte = *buff++;
|
if (bitPattern & 0x80) dataByte = *buff++;
|
||||||
|
|
||||||
a = a << 1;
|
a = a << 1;
|
||||||
if ( a & 0x10000) a ^= crcConst;
|
if ( a & 0x10000) a ^= crcConst;
|
||||||
if (dataByte & (bitPattern >> 24)) a ^= crcConst;
|
if (dataByte & (bitPattern >> 24)) a ^= crcConst;
|
||||||
|
|
||||||
b = b << 1;
|
b = b << 1;
|
||||||
if (b & 0x10000) b ^= crcConst;
|
if (b & 0x10000) b ^= crcConst;
|
||||||
if (dataByte & (bitPattern >> 25)) b ^= crcConst;
|
if (dataByte & (bitPattern >> 25)) b ^= crcConst;
|
||||||
|
|
||||||
c = c << 1;
|
c = c << 1;
|
||||||
if (c & 0x10000) c ^= crcConst;
|
if (c & 0x10000) c ^= crcConst;
|
||||||
if (dataByte & (bitPattern >> 26)) c ^= crcConst;
|
if (dataByte & (bitPattern >> 26)) c ^= crcConst;
|
||||||
|
|
||||||
d = d << 1;
|
d = d << 1;
|
||||||
if (d & 0x10000) d ^= crcConst;
|
if (d & 0x10000) d ^= crcConst;
|
||||||
if (dataByte & (bitPattern >> 27)) d ^= crcConst;
|
if (dataByte & (bitPattern >> 27)) d ^= crcConst;
|
||||||
|
|
||||||
bitPattern = (bitPattern >> 4) | (bitPattern << 28);
|
bitPattern = (bitPattern >> 4) | (bitPattern << 28);
|
||||||
} while (buffLength-=4);
|
} while (buffLength-=4);
|
||||||
|
|
||||||
count = 16; // r8
|
count = 16; // r8
|
||||||
|
|
||||||
do {
|
do {
|
||||||
bitPattern = bitPattern << 4;
|
bitPattern = bitPattern << 4;
|
||||||
if (a & 0x8000) bitPattern |= 8;
|
if (a & 0x8000) bitPattern |= 8;
|
||||||
if (b & 0x8000) bitPattern |= 4;
|
if (b & 0x8000) bitPattern |= 4;
|
||||||
if (c & 0x8000) bitPattern |= 2;
|
if (c & 0x8000) bitPattern |= 2;
|
||||||
if (d & 0x8000) bitPattern |= 1;
|
if (d & 0x8000) bitPattern |= 1;
|
||||||
|
|
||||||
a = a << 1;
|
a = a << 1;
|
||||||
b = b << 1;
|
b = b << 1;
|
||||||
c = c << 1;
|
c = c << 1;
|
||||||
d = d << 1;
|
d = d << 1;
|
||||||
|
|
||||||
count--;
|
count--;
|
||||||
|
|
||||||
if (!(count & 0x01)) {
|
if (!(count & 0x01)) {
|
||||||
*crc16buff++ = (u8)(bitPattern & 0xff);
|
*crc16buff++ = (u8)(bitPattern & 0xff);
|
||||||
}
|
}
|
||||||
} while (count != 0);
|
} while (count != 0);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,20 +136,20 @@ cmd_17byte_response: a pointer to a function that sends the SD card a command an
|
||||||
use4bitBus: initialise card to use a 4 bit data bus when communicating with the card
|
use4bitBus: initialise card to use a 4 bit data bus when communicating with the card
|
||||||
RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits.
|
RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits.
|
||||||
*/
|
*/
|
||||||
bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
||||||
_SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response,
|
_SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response,
|
||||||
bool use4bitBus,
|
bool use4bitBus,
|
||||||
u32 *RCA)
|
u32 *RCA)
|
||||||
{
|
{
|
||||||
u8 responseBuffer[17] = {0};
|
u8 responseBuffer[17] = {0};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
||||||
cmd_6byte_response (responseBuffer, APP_CMD, 0);
|
cmd_6byte_response (responseBuffer, APP_CMD, 0);
|
||||||
if (
|
if (
|
||||||
cmd_6byte_response (responseBuffer, SD_APP_OP_COND, SD_OCR_VALUE) &&
|
cmd_6byte_response (responseBuffer, SD_APP_OP_COND, SD_OCR_VALUE) &&
|
||||||
((responseBuffer[1] & 0x80) != 0))
|
((responseBuffer[1] & 0x80) != 0))
|
||||||
{
|
{
|
||||||
// Card is ready to receive commands now
|
// Card is ready to receive commands now
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -157,10 +157,10 @@ bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
||||||
if (i >= MAX_STARTUP_TRIES) {
|
if (i >= MAX_STARTUP_TRIES) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The card's name, as assigned by the manufacturer
|
// The card's name, as assigned by the manufacturer
|
||||||
cmd_17byte_response (responseBuffer, ALL_SEND_CID, 0);
|
cmd_17byte_response (responseBuffer, ALL_SEND_CID, 0);
|
||||||
|
|
||||||
// Get a new address
|
// Get a new address
|
||||||
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
for (i = 0; i < MAX_STARTUP_TRIES ; i++) {
|
||||||
cmd_6byte_response (responseBuffer, SEND_RELATIVE_ADDR, 0);
|
cmd_6byte_response (responseBuffer, SEND_RELATIVE_ADDR, 0);
|
||||||
|
@ -169,16 +169,16 @@ bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i >= MAX_STARTUP_TRIES) {
|
if (i >= MAX_STARTUP_TRIES) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some cards won't go to higher speeds unless they think you checked their capabilities
|
// Some cards won't go to higher speeds unless they think you checked their capabilities
|
||||||
cmd_17byte_response (responseBuffer, SEND_CSD, *RCA);
|
cmd_17byte_response (responseBuffer, SEND_CSD, *RCA);
|
||||||
|
|
||||||
// Only this card should respond to all future commands
|
// Only this card should respond to all future commands
|
||||||
cmd_6byte_response (responseBuffer, SELECT_CARD, *RCA);
|
cmd_6byte_response (responseBuffer, SELECT_CARD, *RCA);
|
||||||
|
|
||||||
if (use4bitBus) {
|
if (use4bitBus) {
|
||||||
// Set a 4 bit data bus
|
// Set a 4 bit data bus
|
||||||
cmd_6byte_response (responseBuffer, APP_CMD, *RCA);
|
cmd_6byte_response (responseBuffer, APP_CMD, *RCA);
|
||||||
|
@ -187,7 +187,7 @@ bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
||||||
|
|
||||||
// Use 512 byte blocks
|
// Use 512 byte blocks
|
||||||
cmd_6byte_response (responseBuffer, SET_BLOCKLEN, 512); // 512 byte blocks
|
cmd_6byte_response (responseBuffer, SET_BLOCKLEN, 512); // 512 byte blocks
|
||||||
|
|
||||||
// Wait until card is ready for data
|
// Wait until card is ready for data
|
||||||
i = 0;
|
i = 0;
|
||||||
do {
|
do {
|
||||||
|
@ -196,7 +196,7 @@ bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
} while (!cmd_6byte_response (responseBuffer, SEND_STATUS, *RCA) && ((responseBuffer[3] & 0x1f) != ((SD_STATE_TRAN << 1) | READY_FOR_DATA)));
|
} while (!cmd_6byte_response (responseBuffer, SEND_STATUS, *RCA) && ((responseBuffer[3] & 0x1f) != ((SD_STATE_TRAN << 1) | READY_FOR_DATA)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
SD routines partially based on sd.s by Romman
|
SD routines partially based on sd.s by Romman
|
||||||
|
|
||||||
Copyright (c) 2006 Michael "Chishm" Chisholm
|
Copyright (c) 2006 Michael "Chishm" Chisholm
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
are permitted provided that the following conditions are met:
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
2006-07-11 - Chishm
|
2006-07-11 - Chishm
|
||||||
* Original release
|
* Original release
|
||||||
|
|
||||||
2006-07-28 - Chishm
|
2006-07-28 - Chishm
|
||||||
* Changed voltage range that the SD card can use
|
* Changed voltage range that the SD card can use
|
||||||
*/
|
*/
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
#define SD_STATE_IDENT 2 // Identification state, after ALL_SEND_CID
|
#define SD_STATE_IDENT 2 // Identification state, after ALL_SEND_CID
|
||||||
#define SD_STATE_STBY 3 // Standby state, when card is deselected
|
#define SD_STATE_STBY 3 // Standby state, when card is deselected
|
||||||
#define SD_STATE_TRAN 4 // Transfer state, after card is selected and ready for data transfer
|
#define SD_STATE_TRAN 4 // Transfer state, after card is selected and ready for data transfer
|
||||||
#define SD_STATE_DATA 5 //
|
#define SD_STATE_DATA 5 //
|
||||||
#define SD_STATE_RCV 6 // Receive data state
|
#define SD_STATE_RCV 6 // Receive data state
|
||||||
#define SD_STATE_PRG 7 // Programming state
|
#define SD_STATE_PRG 7 // Programming state
|
||||||
#define SD_STATE_DIS 8 // Disconnect state
|
#define SD_STATE_DIS 8 // Disconnect state
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
#define READY_FOR_DATA 1 // bit 8 in card status
|
#define READY_FOR_DATA 1 // bit 8 in card status
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calculate the CRC7 of a command and return it preshifted with
|
Calculate the CRC7 of a command and return it preshifted with
|
||||||
an end bit added
|
an end bit added
|
||||||
*/
|
*/
|
||||||
extern u8 _SD_CRC7(u8* data, int size);
|
extern u8 _SD_CRC7(u8* data, int size);
|
||||||
|
@ -106,7 +106,7 @@ cmd_17byte_response: a pointer to a function that sends the SD card a command an
|
||||||
use4bitBus: initialise card to use a 4 bit data bus when communicating with the card
|
use4bitBus: initialise card to use a 4 bit data bus when communicating with the card
|
||||||
RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits.
|
RCA: a pointer to the location to store the card's Relative Card Address, preshifted up by 16 bits.
|
||||||
*/
|
*/
|
||||||
extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
extern bool _SD_InitCard (_SD_FN_CMD_6BYTE_RESPONSE cmd_6byte_response,
|
||||||
_SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response,
|
_SD_FN_CMD_17BYTE_RESPONSE cmd_17byte_response,
|
||||||
bool use4bitBus,
|
bool use4bitBus,
|
||||||
u32 *RCA);
|
u32 *RCA);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "gbampsave.h"
|
#include "gbampsave.h"
|
||||||
#include "gba_nds_fat.h"
|
#include "gba_nds_fat.h"
|
||||||
#include "ds-fs.h"
|
#include "ds-fs.h"
|
||||||
|
#include "config-manager.h"
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// GBAMP Save File
|
// GBAMP Save File
|
||||||
|
@ -30,7 +31,7 @@
|
||||||
|
|
||||||
GBAMPSaveFile::GBAMPSaveFile(char* name, bool saveOrLoad) {
|
GBAMPSaveFile::GBAMPSaveFile(char* name, bool saveOrLoad) {
|
||||||
handle = DS::std_fopen(name, saveOrLoad? "w": "r");
|
handle = DS::std_fopen(name, saveOrLoad? "w": "r");
|
||||||
consolePrintf("%s handle is %d\n", name, handle);
|
// consolePrintf("%s handle is %d\n", name, handle);
|
||||||
// consolePrintf("Created %s\n", name);
|
// consolePrintf("Created %s\n", name);
|
||||||
bufferPos = 0;
|
bufferPos = 0;
|
||||||
saveSize = 0;
|
saveSize = 0;
|
||||||
|
@ -92,40 +93,40 @@ uint32 GBAMPSaveFile::write(const void *buf, uint32 size) {
|
||||||
|
|
||||||
memcpy(buffer + bufferPos, buf, size);
|
memcpy(buffer + bufferPos, buf, size);
|
||||||
bufferPos += size;
|
bufferPos += size;
|
||||||
|
|
||||||
saveSize += size;
|
saveSize += size;
|
||||||
|
|
||||||
|
|
||||||
/* int pos = 0;
|
/* int pos = 0;
|
||||||
|
|
||||||
int rest = SAVE_BUFFER_SIZE - bufferPos;
|
int rest = SAVE_BUFFER_SIZE - bufferPos;
|
||||||
memcpy(buffer + bufferPos, buf, rest);
|
memcpy(buffer + bufferPos, buf, rest);
|
||||||
bufferPos = 512;
|
bufferPos = 512;
|
||||||
pos += rest;
|
pos += rest;
|
||||||
flushSaveBuffer();
|
flushSaveBuffer();
|
||||||
size -= rest;
|
size -= rest;
|
||||||
// consolePrintf("First section: %d\n", rest);
|
// consolePrintf("First section: %d\n", rest);
|
||||||
|
|
||||||
while (size >= 512) {
|
while (size >= 512) {
|
||||||
DS::std_fwrite(((char *) (buf)) + pos, 1, 512, handle);
|
DS::std_fwrite(((char *) (buf)) + pos, 1, 512, handle);
|
||||||
size -= 512;
|
size -= 512;
|
||||||
pos += 512;
|
pos += 512;
|
||||||
// consolePrintf("Full chunk, %d left ", size);
|
// consolePrintf("Full chunk, %d left ", size);
|
||||||
}
|
}
|
||||||
|
|
||||||
bufferPos = 0;
|
bufferPos = 0;
|
||||||
memcpy(buffer + bufferPos, ((char *) (buf)) + pos, size);
|
memcpy(buffer + bufferPos, ((char *) (buf)) + pos, size);
|
||||||
bufferPos += size;
|
bufferPos += size;
|
||||||
// consolePrintf("%d left in buffer ", bufferPos);*/
|
// consolePrintf("%d left in buffer ", bufferPos);*/
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
memcpy(buffer + bufferPos, buf, size);
|
memcpy(buffer + bufferPos, buf, size);
|
||||||
bufferPos += size;
|
bufferPos += size;
|
||||||
|
|
||||||
saveSize += size;
|
saveSize += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ((size > 100) || (size <= 0)) consolePrintf("Write %d bytes\n", size);
|
// if ((size > 100) || (size <= 0)) consolePrintf("Write %d bytes\n", size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -145,40 +146,62 @@ GBAMPSaveFileManager::~GBAMPSaveFileManager() {
|
||||||
|
|
||||||
GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) {
|
GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) {
|
||||||
char fileSpec[128];
|
char fileSpec[128];
|
||||||
|
|
||||||
strcpy(fileSpec, getSavePath().c_str());
|
strcpy(fileSpec, getSavePath());
|
||||||
|
|
||||||
if (fileSpec[strlen(fileSpec) - 1] == '/') {
|
if (fileSpec[strlen(fileSpec) - 1] == '/') {
|
||||||
sprintf(fileSpec, "%s%s", getSavePath(), name);
|
sprintf(fileSpec, "%s%s", getSavePath(), name);
|
||||||
} else {
|
} else {
|
||||||
sprintf(fileSpec, "%s/%s", getSavePath(), name);
|
sprintf(fileSpec, "%s/%s", getSavePath(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// consolePrintf(fileSpec);
|
// consolePrintf(fileSpec);
|
||||||
GBAMPSaveFile* sf = new GBAMPSaveFile(fileSpec, saveOrLoad);
|
GBAMPSaveFile* sf = new GBAMPSaveFile(fileSpec, saveOrLoad);
|
||||||
if (sf->isOpen()) {
|
if (sf->isOpen()) {
|
||||||
return sf;
|
return sf;
|
||||||
} else {
|
} else {
|
||||||
delete sf;
|
delete sf;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
|
// This method copied from an old version of the savefile.cpp, since it's been removed from there and
|
||||||
|
// placed in default-saves.cpp, where I cannot call it.
|
||||||
|
const char *GBAMPSaveFileManager::getSavePath() const {
|
||||||
|
const char *dir = NULL;
|
||||||
|
|
||||||
|
// Try to use game specific savepath from config
|
||||||
|
dir = ConfMan.get("savepath").c_str();
|
||||||
|
|
||||||
|
// Work around a bug (#999122) in the original 0.6.1 release of
|
||||||
|
// ScummVM, which would insert a bad savepath value into config files.
|
||||||
|
if (0 == strcmp(dir, "None")) {
|
||||||
|
ConfMan.removeKey("savepath", ConfMan.getActiveDomainName());
|
||||||
|
ConfMan.flushToDisk();
|
||||||
|
dir = ConfMan.get("savepath").c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
assert(dir);
|
||||||
|
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
|
||||||
|
|
||||||
enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
|
enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
|
||||||
char name[256];
|
char name[256];
|
||||||
|
|
||||||
DS::std_cwd((char*)getSavePath().c_str()); //TODO : Check this suspicious const-cast
|
DS::std_cwd((char*)getSavePath()); //TODO : Check this suspicious const-cast
|
||||||
// consolePrintf("Save path: '%s', pattern: '%s'\n", getSavePath(),pattern);
|
// consolePrintf("Save path: '%s', pattern: '%s'\n", getSavePath(),pattern);
|
||||||
|
|
||||||
|
|
||||||
int fileType = FAT_FindFirstFileLFN(name);
|
int fileType = FAT_FindFirstFileLFN(name);
|
||||||
|
|
||||||
Common::StringList list;
|
Common::StringList list;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
if (fileType == TYPE_FILE) {
|
if (fileType == TYPE_FILE) {
|
||||||
|
|
||||||
FAT_GetLongFilename(name);
|
FAT_GetLongFilename(name);
|
||||||
|
@ -186,18 +209,18 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
|
||||||
for (int r = 0; r < strlen(name); r++) {
|
for (int r = 0; r < strlen(name); r++) {
|
||||||
name[r] = tolower(name[r]);
|
name[r] = tolower(name[r]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Common::matchString(name, pattern)) {
|
if (Common::matchString(name, pattern)) {
|
||||||
list.push_back(name);
|
list.push_back(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ((fileType = FAT_FindNextFileLFN(name)));
|
} while ((fileType = FAT_FindNextFileLFN(name)));
|
||||||
|
|
||||||
FAT_chdir("/");
|
FAT_chdir("/");
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,11 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _GBAMPSAVE_H_
|
#ifndef _GBAMPSAVE_H_
|
||||||
#define _GBAMPSAVE_H_
|
#define _GBAMPSAVE_H_
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "saves/default/default-saves.h"
|
|
||||||
#include "ds-fs.h"
|
#include "ds-fs.h"
|
||||||
|
|
||||||
#define SAVE_BUFFER_SIZE 100000
|
#define SAVE_BUFFER_SIZE 100000
|
||||||
|
@ -39,42 +38,44 @@ class GBAMPSaveFile : public Common::InSaveFile, public Common::OutSaveFile {
|
||||||
public:
|
public:
|
||||||
GBAMPSaveFile(char* name, bool saveOrLoad);
|
GBAMPSaveFile(char* name, bool saveOrLoad);
|
||||||
virtual ~GBAMPSaveFile();
|
virtual ~GBAMPSaveFile();
|
||||||
|
|
||||||
virtual uint32 read(void *buf, uint32 size);
|
virtual uint32 read(void *buf, uint32 size);
|
||||||
virtual uint32 write(const void *buf, uint32 size);
|
virtual uint32 write(const void *buf, uint32 size);
|
||||||
|
|
||||||
virtual bool eos() const;
|
virtual bool eos() const;
|
||||||
virtual void skip(uint32 bytes);
|
virtual void skip(uint32 bytes);
|
||||||
|
|
||||||
virtual uint32 pos() const;
|
virtual uint32 pos() const;
|
||||||
virtual uint32 size() const;
|
virtual uint32 size() const;
|
||||||
virtual void seek(int32 pos, int whence);
|
virtual void seek(int32 pos, int whence);
|
||||||
|
|
||||||
void flushSaveBuffer();
|
void flushSaveBuffer();
|
||||||
|
|
||||||
virtual bool isOpen() const {
|
virtual bool isOpen() const {
|
||||||
return handle != 0;
|
return handle != 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class GBAMPSaveFileManager : public DefaultSaveFileManager {
|
class GBAMPSaveFileManager : public Common::SaveFileManager {
|
||||||
public:
|
public:
|
||||||
GBAMPSaveFileManager();
|
GBAMPSaveFileManager();
|
||||||
~GBAMPSaveFileManager();
|
~GBAMPSaveFileManager();
|
||||||
|
|
||||||
// static GBAMPSaveFileManager* instance() { return instancePtr; }
|
// static GBAMPSaveFileManager* instance() { return instancePtr; }
|
||||||
|
|
||||||
GBAMPSaveFile *openSavefile(const char *filename, bool saveOrLoad);
|
GBAMPSaveFile *openSavefile(const char *filename, bool saveOrLoad);
|
||||||
|
|
||||||
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
|
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
|
||||||
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
|
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
|
||||||
|
|
||||||
virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
|
virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
|
||||||
virtual Common::StringList listSavefiles(const char *pattern);
|
virtual Common::StringList listSavefiles(const char *pattern);
|
||||||
|
|
||||||
void deleteFile(char* name);
|
void deleteFile(char* name);
|
||||||
void listFiles();
|
void listFiles();
|
||||||
|
|
||||||
|
const char *getSavePath() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,26 +27,26 @@
|
||||||
$Log: keys.c,v $
|
$Log: keys.c,v $
|
||||||
Revision 1.13 2006/01/12 09:10:47 wntrmute
|
Revision 1.13 2006/01/12 09:10:47 wntrmute
|
||||||
Added key repeat as suggested by pepsiman
|
Added key repeat as suggested by pepsiman
|
||||||
|
|
||||||
Revision 1.12 2005/11/27 12:30:25 wntrmute
|
Revision 1.12 2005/11/27 12:30:25 wntrmute
|
||||||
reverted to correct hardware REGisters
|
reverted to correct hardware REGisters
|
||||||
|
|
||||||
Revision 1.11 2005/11/27 07:48:45 joatski
|
Revision 1.11 2005/11/27 07:48:45 joatski
|
||||||
Renamed REG_KEYINPUT and REG_KEYCNT back to KEYS and KEYS_CR, as the alternatives are defined in registers_alt.h.
|
Renamed REG_KEYINPUT and REG_KEYCNT back to KEYS and KEYS_CR, as the alternatives are defined in registers_alt.h.
|
||||||
Changed function returns to uint32
|
Changed function returns to uint32
|
||||||
|
|
||||||
Revision 1.10 2005/11/03 23:38:49 wntrmute
|
Revision 1.10 2005/11/03 23:38:49 wntrmute
|
||||||
don't use enum for key function returns
|
don't use enum for key function returns
|
||||||
|
|
||||||
Revision 1.9 2005/10/13 16:30:11 dovoto
|
Revision 1.9 2005/10/13 16:30:11 dovoto
|
||||||
Changed KEYPAD_BITS to a typedef enum, this resolved some issues with multiple redefinition of KEYPAD_BITS (although this error did not allways occur).
|
Changed KEYPAD_BITS to a typedef enum, this resolved some issues with multiple redefinition of KEYPAD_BITS (although this error did not allways occur).
|
||||||
|
|
||||||
Revision 1.8 2005/10/03 21:21:59 wntrmute
|
Revision 1.8 2005/10/03 21:21:59 wntrmute
|
||||||
use enum types
|
use enum types
|
||||||
|
|
||||||
Revision 1.7 2005/09/07 18:06:27 wntrmute
|
Revision 1.7 2005/09/07 18:06:27 wntrmute
|
||||||
use new register names
|
use new register names
|
||||||
|
|
||||||
Revision 1.6 2005/08/23 17:06:10 wntrmute
|
Revision 1.6 2005/08/23 17:06:10 wntrmute
|
||||||
converted all endings to unix
|
converted all endings to unix
|
||||||
|
|
||||||
|
@ -148,4 +148,4 @@ uint32 keysUp(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace ds
|
} // namespace ds
|
|
@ -37,6 +37,7 @@
|
||||||
#include "cdaudio.h"
|
#include "cdaudio.h"
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
#include "touchkeyboard.h"
|
#include "touchkeyboard.h"
|
||||||
|
#include "ds-fs-factory.h"
|
||||||
|
|
||||||
OSystem_DS* OSystem_DS::_instance = NULL;
|
OSystem_DS* OSystem_DS::_instance = NULL;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ int OSystem_DS::timerHandler(int t) {
|
||||||
tm->handler();
|
tm->handler();
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_DS::initBackend() {
|
void OSystem_DS::initBackend() {
|
||||||
ConfMan.setInt("autosave_period", 0);
|
ConfMan.setInt("autosave_period", 0);
|
||||||
ConfMan.setBool("FM_medium_quality", true);
|
ConfMan.setBool("FM_medium_quality", true);
|
||||||
|
@ -71,7 +72,7 @@ void OSystem_DS::initBackend() {
|
||||||
_timer = new DSTimerManager;
|
_timer = new DSTimerManager;
|
||||||
DS::setSoundProc(Audio::Mixer::mixCallback, _mixer);
|
DS::setSoundProc(Audio::Mixer::mixCallback, _mixer);
|
||||||
DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
|
DS::setTimerCallback(&OSystem_DS::timerHandler, 10);
|
||||||
|
|
||||||
OSystem::initBackend();
|
OSystem::initBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,20 +135,20 @@ void OSystem_DS::setPalette(const byte *colors, uint start, uint num) {
|
||||||
int red = *colors;
|
int red = *colors;
|
||||||
int green = *(colors + 1);
|
int green = *(colors + 1);
|
||||||
int blue = *(colors + 2);
|
int blue = *(colors + 2);
|
||||||
|
|
||||||
red >>= 3;
|
red >>= 3;
|
||||||
green >>= 3;
|
green >>= 3;
|
||||||
blue >>= 3;
|
blue >>= 3;
|
||||||
|
|
||||||
// if (r != 255)
|
// if (r != 255)
|
||||||
{
|
{
|
||||||
BG_PALETTE[r] = red | (green << 5) | (blue << 10);
|
BG_PALETTE[r] = red | (green << 5) | (blue << 10);
|
||||||
if (!DS::getKeyboardEnable()) {
|
if (!DS::getKeyboardEnable()) {
|
||||||
BG_PALETTE_SUB[r] = red | (green << 5) | (blue << 10);
|
BG_PALETTE_SUB[r] = red | (green << 5) | (blue << 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (num == 16) consolePrintf("pal:%d r:%d g:%d b:%d\n", r, red, green, blue);
|
// if (num == 16) consolePrintf("pal:%d r:%d g:%d b:%d\n", r, red, green, blue);
|
||||||
|
|
||||||
colors += 4;
|
colors += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +157,7 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
|
||||||
surf->create(DS::getGameWidth(), DS::getGameHeight(), 1);
|
surf->create(DS::getGameWidth(), DS::getGameHeight(), 1);
|
||||||
|
|
||||||
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
|
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
|
||||||
|
|
||||||
|
|
||||||
u16* image = (u16 *) DS::get8BitBackBuffer();
|
u16* image = (u16 *) DS::get8BitBackBuffer();
|
||||||
for (int y = 0; y < DS::getGameHeight(); y++)
|
for (int y = 0; y < DS::getGameHeight(); y++)
|
||||||
|
@ -173,7 +174,7 @@ bool OSystem_DS::grabRawScreen(Graphics::Surface* surf) {
|
||||||
|
|
||||||
void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
|
void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
|
||||||
// consolePrintf("Grabpalette");
|
// consolePrintf("Grabpalette");
|
||||||
|
|
||||||
for (unsigned int r = start; r < start + num; r++) {
|
for (unsigned int r = start; r < start + num; r++) {
|
||||||
*colors++ = (BG_PALETTE[r] & 0x001F) << 3;
|
*colors++ = (BG_PALETTE[r] & 0x001F) << 3;
|
||||||
*colors++ = (BG_PALETTE[r] & 0x03E0) >> 5 << 3;
|
*colors++ = (BG_PALETTE[r] & 0x03E0) >> 5 << 3;
|
||||||
|
@ -184,60 +185,67 @@ void OSystem_DS::grabPalette(unsigned char *colors, uint start, uint num) {
|
||||||
|
|
||||||
void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
|
void OSystem_DS::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
|
||||||
// consolePrintf("Copy rect %d, %d %d, %d ", x, y, w, h);
|
// consolePrintf("Copy rect %d, %d %d, %d ", x, y, w, h);
|
||||||
|
|
||||||
if (w <= 1) return;
|
if (w <= 1) return;
|
||||||
if (h < 0) return;
|
if (h < 0) return;
|
||||||
if (!DS::getIsDisplayMode8Bit()) return;
|
if (!DS::getIsDisplayMode8Bit()) return;
|
||||||
|
|
||||||
|
u16* bg;
|
||||||
|
s32 stride;
|
||||||
u16* bgSub = (u16 *) BG_GFX_SUB;
|
u16* bgSub = (u16 *) BG_GFX_SUB;
|
||||||
u16* bg = (u16 *) DS::get8BitBackBuffer();
|
|
||||||
|
if (_frameBufferExists) {
|
||||||
|
bg = (u16 *) _framebuffer.pixels;
|
||||||
|
stride = _framebuffer.pitch;
|
||||||
|
} else {
|
||||||
|
bg = (u16 *) DS::get8BitBackBuffer();
|
||||||
|
stride = DS::get8BitBackBufferStride();
|
||||||
|
}
|
||||||
|
|
||||||
u16* src = (u16 *) buf;
|
u16* src = (u16 *) buf;
|
||||||
|
|
||||||
if (DS::getKeyboardEnable()) {
|
if (DS::getKeyboardEnable()) {
|
||||||
|
|
||||||
for (int dy = y; dy < y + h; dy++) {
|
for (int dy = y; dy < y + h; dy++) {
|
||||||
u16* dest = bg + (dy << 8) + (x >> 1);
|
u16* dest = bg + (dy * (stride >> 1)) + (x >> 1);
|
||||||
|
|
||||||
DC_FlushRange(src, w << 1);
|
DC_FlushRange(src, w << 1);
|
||||||
DC_FlushRange(dest, w << 1);
|
DC_FlushRange(dest, w << 1);
|
||||||
dmaCopyHalfWords(3, src, dest, w);
|
dmaCopyHalfWords(3, src, dest, w);
|
||||||
|
|
||||||
src += pitch >> 1;
|
src += pitch >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (int dy = y; dy < y + h; dy++) {
|
for (int dy = y; dy < y + h; dy++) {
|
||||||
u16* dest1 = bg + (dy << 8) + (x >> 1);
|
u16* dest1 = bg + (dy * (stride >> 1)) + (x >> 1);
|
||||||
u16* dest2 = bgSub + (dy << 8) + (x >> 1);
|
u16* dest2 = bgSub + (dy << 8) + (x >> 1);
|
||||||
|
|
||||||
DC_FlushRange(src, w << 1);
|
DC_FlushRange(src, w << 1);
|
||||||
DC_FlushRange(dest1, w << 1);
|
DC_FlushRange(dest1, w << 1);
|
||||||
DC_FlushRange(dest2, w << 1);
|
DC_FlushRange(dest2, w << 1);
|
||||||
|
|
||||||
dmaCopyHalfWords(3, src, dest1, w);
|
dmaCopyHalfWords(3, src, dest1, w);
|
||||||
dmaCopyHalfWords(3, src, dest2, w);
|
dmaCopyHalfWords(3, src, dest2, w);
|
||||||
|
|
||||||
src += pitch >> 1;
|
src += pitch >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// consolePrintf("Done\n");
|
// consolePrintf("Done\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_DS::updateScreen() {
|
void OSystem_DS::updateScreen() {
|
||||||
|
|
||||||
if (_frameBufferExists)
|
if ((_frameBufferExists) && (DS::getIsDisplayMode8Bit()))
|
||||||
{
|
{
|
||||||
|
_frameBufferExists = false;
|
||||||
|
|
||||||
// Copy temp framebuffer back to screen
|
// Copy temp framebuffer back to screen
|
||||||
copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
|
copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
|
||||||
|
|
||||||
// Free memory
|
|
||||||
_framebuffer.free();
|
|
||||||
|
|
||||||
_frameBufferExists = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DS::displayMode16BitFlipBuffer();
|
DS::displayMode16BitFlipBuffer();
|
||||||
|
@ -271,36 +279,36 @@ void OSystem_DS::grabOverlay (OverlayColor *buf, int pitch) {
|
||||||
void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
|
void OSystem_DS::copyRectToOverlay (const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
|
||||||
u16* bg = (u16 *) DS::get16BitBackBuffer();
|
u16* bg = (u16 *) DS::get16BitBackBuffer();
|
||||||
u16* src = (u16 *) buf;
|
u16* src = (u16 *) buf;
|
||||||
|
|
||||||
// if (x + w > 256) w = 256 - x;
|
// if (x + w > 256) w = 256 - x;
|
||||||
//if (x + h > 256) h = 256 - y;
|
//if (x + h > 256) h = 256 - y;
|
||||||
|
|
||||||
// consolePrintf("Copy rect ovl %d, %d %d, %d %d\n", x, y, w, h, pitch);
|
// consolePrintf("Copy rect ovl %d, %d %d, %d %d\n", x, y, w, h, pitch);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int dy = y; dy < y + h; dy++) {
|
for (int dy = y; dy < y + h; dy++) {
|
||||||
|
|
||||||
|
|
||||||
// Slow but save copy:
|
// Slow but save copy:
|
||||||
for (int dx = x; dx < x + w; dx++) {
|
for (int dx = x; dx < x + w; dx++) {
|
||||||
|
|
||||||
*(bg + (dy * 512) + dx) = *src;
|
*(bg + (dy * 512) + dx) = *src;
|
||||||
//if ((*src) != 0) consolePrintf("%d,%d: %d ", dx, dy, *src);
|
//if ((*src) != 0) consolePrintf("%d,%d: %d ", dx, dy, *src);
|
||||||
//consolePrintf("%d,", *src);
|
//consolePrintf("%d,", *src);
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
src += (pitch - w);
|
src += (pitch - w);
|
||||||
|
|
||||||
// Fast but broken copy: (why?)
|
// Fast but broken copy: (why?)
|
||||||
/*
|
/*
|
||||||
REG_IME = 0;
|
REG_IME = 0;
|
||||||
dmaCopy(src, bg + (dy << 9) + x, w * 2);
|
dmaCopy(src, bg + (dy << 9) + x, w * 2);
|
||||||
REG_IME = 1;
|
REG_IME = 1;
|
||||||
|
|
||||||
src += pitch;*/
|
src += pitch;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// consolePrintf("Copy rect ovl done");
|
// consolePrintf("Copy rect ovl done");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -315,7 +323,7 @@ int16 OSystem_DS::getOverlayWidth() {
|
||||||
return getWidth();
|
return getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool OSystem_DS::showMouse(bool visible) {
|
bool OSystem_DS::showMouse(bool visible) {
|
||||||
DS::setShowCursor(visible);
|
DS::setShowCursor(visible);
|
||||||
return true;
|
return true;
|
||||||
|
@ -353,7 +361,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* if (lastPenFrame != DS::getMillis()) {
|
/* if (lastPenFrame != DS::getMillis()) {
|
||||||
|
@ -366,7 +374,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) {
|
||||||
if (eventNum == 1) {
|
if (eventNum == 1) {
|
||||||
eventNum = 0;
|
eventNum = 0;
|
||||||
lastPenFrame = DS::getMillis();
|
lastPenFrame = DS::getMillis();
|
||||||
if (DS::getPenDown()) {
|
if (DS::getPenDown()) {
|
||||||
event.type = Common::EVENT_LBUTTONDOWN;
|
event.type = Common::EVENT_LBUTTONDOWN;
|
||||||
event.mouse = Common::Point(DS::getPenX(), DS::getPenY());
|
event.mouse = Common::Point(DS::getPenX(), DS::getPenY());
|
||||||
consolePrintf("Down %d, %d ", event.mouse.x, event.mouse.y);
|
consolePrintf("Down %d, %d ", event.mouse.x, event.mouse.y);
|
||||||
|
@ -393,12 +401,12 @@ void OSystem_DS::delayMillis(uint msecs) {
|
||||||
int st = getMillis();
|
int st = getMillis();
|
||||||
DS::addEventsToQueue();
|
DS::addEventsToQueue();
|
||||||
DS::CD::update();
|
DS::CD::update();
|
||||||
|
|
||||||
DS::doSoundCallback();
|
DS::doSoundCallback();
|
||||||
while (st + msecs >= getMillis()) {
|
while (st + msecs >= getMillis()) {
|
||||||
DS::doSoundCallback();
|
DS::doSoundCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
DS::doTimerCallback();
|
DS::doTimerCallback();
|
||||||
DS::checkSleepMode();
|
DS::checkSleepMode();
|
||||||
DS::addEventsToQueue();
|
DS::addEventsToQueue();
|
||||||
|
@ -409,6 +417,10 @@ void OSystem_DS::getTimeAndDate(struct tm &t) const {
|
||||||
t = *localtime(&curTime);
|
t = *localtime(&curTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilesystemFactory *OSystem_DS::getFilesystemFactory() {
|
||||||
|
return &DSFilesystemFactory::instance();
|
||||||
|
}
|
||||||
|
|
||||||
OSystem::MutexRef OSystem_DS::createMutex(void) {
|
OSystem::MutexRef OSystem_DS::createMutex(void) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -423,7 +435,7 @@ void OSystem_DS::deleteMutex(MutexRef mutex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_DS::clearSoundCallback() {
|
void OSystem_DS::clearSoundCallback() {
|
||||||
consolePrintf("Clearing sound callback");
|
// consolePrintf("Clearing sound callback");
|
||||||
// DS::setSoundProc(NULL, NULL);
|
// DS::setSoundProc(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +468,7 @@ void OSystem_DS::quit() {
|
||||||
/* consolePrintf("Soft resetting...");
|
/* consolePrintf("Soft resetting...");
|
||||||
IPC->reset = 1;
|
IPC->reset = 1;
|
||||||
REG_IE = 0;
|
REG_IE = 0;
|
||||||
|
|
||||||
asm("swi 0x26\n");
|
asm("swi 0x26\n");
|
||||||
swiSoftReset();*/
|
swiSoftReset();*/
|
||||||
}
|
}
|
||||||
|
@ -475,10 +487,10 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager() {
|
||||||
} else {
|
} else {
|
||||||
forceSram = false;
|
forceSram = false;
|
||||||
}
|
}
|
||||||
if (forceSram) {
|
if (forceSram) {
|
||||||
consolePrintf("Using SRAM save method!\n");
|
consolePrintf("Using SRAM save method!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DS::isGBAMPAvailable() && (!forceSram)) {
|
if (DS::isGBAMPAvailable() && (!forceSram)) {
|
||||||
return &mpSaveManager;
|
return &mpSaveManager;
|
||||||
} else {
|
} else {
|
||||||
|
@ -488,28 +500,64 @@ Common::SaveFileManager* OSystem_DS::getSavefileManager() {
|
||||||
|
|
||||||
|
|
||||||
Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
|
Graphics::Surface* OSystem_DS::createTempFrameBuffer() {
|
||||||
// For now, we create a full temporary screen surface, to which we copy the
|
|
||||||
// the screen content. Later unlockScreen will copy everything back.
|
|
||||||
// Not very nice nor efficient, but at least works, and is not worse
|
|
||||||
// than in the bad old times where we used grabRawScreen + copyRectToScreen.
|
|
||||||
// consolePrintf("lockScreen()\n");
|
|
||||||
_framebuffer.create(DS::getGameWidth(), DS::getGameHeight(), 1);
|
|
||||||
|
|
||||||
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
|
// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
|
||||||
|
|
||||||
size_t imageStrideInBytes = DS::isCpuScalerEnabled()? DS::getGameWidth() : 512;
|
// If the scaler is enabled, we can just return the 8 bit back buffer, since it's in system memory
|
||||||
|
// memory anyway. Otherwise, we need to copy the back buffer into the memory normally used by the scaler buffer and
|
||||||
|
// then return it.
|
||||||
|
// We must make sure that once the frame buffer is created, future calls to copyRectToScreen() copy to this buffer
|
||||||
|
|
||||||
|
if (DS::isCpuScalerEnabled()) {
|
||||||
|
|
||||||
|
_framebuffer.pixels = DS::getScalerBuffer();
|
||||||
|
_framebuffer.w = DS::getGameWidth();
|
||||||
|
_framebuffer.h = DS::getGameHeight();
|
||||||
|
_framebuffer.pitch = DS::getGameWidth();
|
||||||
|
_framebuffer.bytesPerPixel = 1;
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
s32 height = DS::getGameHeight();
|
||||||
|
s32 width = DS::getGameWidth();
|
||||||
|
s32 stride = DS::get8BitBackBufferStride();
|
||||||
|
|
||||||
|
u16* src = DS::get8BitBackBuffer();
|
||||||
|
u16* dest = DS::getScalerBuffer();
|
||||||
|
|
||||||
|
for (int y = 0; y < height; y++) {
|
||||||
|
|
||||||
|
u16* destLine = dest + (y * (width / 2));
|
||||||
|
u16* srcLine = src + (y * (stride / 2));
|
||||||
|
|
||||||
|
DC_FlushRange(srcLine, width);
|
||||||
|
|
||||||
|
dmaCopyHalfWords(3, srcLine, destLine, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
_framebuffer.pixels = dest;
|
||||||
|
_framebuffer.w = width;
|
||||||
|
_framebuffer.h = height;
|
||||||
|
_framebuffer.pitch = width;
|
||||||
|
_framebuffer.bytesPerPixel = 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_frameBufferExists = true;
|
||||||
|
|
||||||
|
/*
|
||||||
|
size_t imageStrideInBytes = DS::get8BitBackBufferStride();
|
||||||
size_t imageStrideInWords = imageStrideInBytes / 2;
|
size_t imageStrideInWords = imageStrideInBytes / 2;
|
||||||
|
|
||||||
u16* image = (u16 *) DS::get8BitBackBuffer();
|
u16* image = (u16 *) DS::get8BitBackBuffer();
|
||||||
for (int y = 0; y < DS::getGameHeight(); y++) {
|
for (int y = 0; y < DS::getGameHeight(); y++) {
|
||||||
DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
|
DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
|
||||||
for (int x = 0; x < DS::getGameWidth() >> 1; x++) {
|
for (int x = 0; x < DS::getGameWidth() >> 1; x++) {
|
||||||
*(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y << 8) + x];
|
*(((u16 *) (_framebuffer.pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[(y * imageStrideInWords) + x];
|
||||||
// *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
|
// *(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
// consolePrintf("lockScreen() done\n");
|
|
||||||
_frameBufferExists = true;
|
|
||||||
|
|
||||||
return &_framebuffer;
|
return &_framebuffer;
|
||||||
}
|
}
|
||||||
|
@ -524,15 +572,7 @@ Graphics::Surface *OSystem_DS::lockScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_DS::unlockScreen() {
|
void OSystem_DS::unlockScreen() {
|
||||||
|
// No need to do anything here. The screen will be updated in updateScreen().
|
||||||
// consolePrintf("unlockScreen()\n");
|
|
||||||
|
|
||||||
// Copy temp framebuffer back to screen
|
|
||||||
// copyRectToScreen((byte *)_framebuffer.pixels, _framebuffer.pitch, 0, 0, _framebuffer.w, _framebuffer.h);
|
|
||||||
|
|
||||||
// Free memory
|
|
||||||
// _framebuffer.free();
|
|
||||||
// consolePrintf("unlockScreen() done\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_DS::setFocusRectangle(const Common::Rect& rect) {
|
void OSystem_DS::setFocusRectangle(const Common::Rect& rect) {
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _OSYSTEM_DS_H_
|
#ifndef _OSYSTEM_DS_H_
|
||||||
#define _OSYSTEM_DS_H_
|
#define _OSYSTEM_DS_H_
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
|
@ -33,10 +33,10 @@
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
|
||||||
class DSAudioMixer : public Audio::Mixer {
|
class DSAudioMixer : public Audio::Mixer {
|
||||||
};
|
};
|
||||||
|
|
||||||
class DSTimerManager : public DefaultTimerManager {
|
class DSTimerManager : public DefaultTimerManager {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ protected:
|
||||||
|
|
||||||
int eventNum;
|
int eventNum;
|
||||||
int lastPenFrame;
|
int lastPenFrame;
|
||||||
|
|
||||||
Common::Event eventQueue[96];
|
Common::Event eventQueue[96];
|
||||||
int queuePos;
|
int queuePos;
|
||||||
|
|
||||||
DSSaveFileManager saveManager;
|
DSSaveFileManager saveManager;
|
||||||
GBAMPSaveFileManager mpSaveManager;
|
GBAMPSaveFileManager mpSaveManager;
|
||||||
DSAudioMixer* _mixer;
|
DSAudioMixer* _mixer;
|
||||||
|
@ -58,7 +58,7 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
static OSystem_DS* _instance;
|
static OSystem_DS* _instance;
|
||||||
|
|
||||||
Graphics::Surface* createTempFrameBuffer();
|
Graphics::Surface* createTempFrameBuffer();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
inline virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
|
inline virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
|
||||||
inline virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
|
inline virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
|
||||||
|
|
||||||
virtual bool showMouse(bool visible);
|
virtual bool showMouse(bool visible);
|
||||||
|
|
||||||
virtual void warpMouse(int x, int y);
|
virtual void warpMouse(int x, int y);
|
||||||
|
@ -131,21 +131,21 @@ public:
|
||||||
virtual void displayMessageOnOSD(const char *msg);
|
virtual void displayMessageOnOSD(const char *msg);
|
||||||
|
|
||||||
virtual Common::SaveFileManager *getSavefileManager();
|
virtual Common::SaveFileManager *getSavefileManager();
|
||||||
|
|
||||||
void addEvent(Common::Event& e);
|
void addEvent(Common::Event& e);
|
||||||
bool isEventQueueEmpty() { return queuePos == 0; }
|
bool isEventQueueEmpty() { return queuePos == 0; }
|
||||||
|
|
||||||
virtual bool grabRawScreen(Graphics::Surface* surf);
|
virtual bool grabRawScreen(Graphics::Surface* surf);
|
||||||
|
|
||||||
virtual void setFocusRectangle(const Common::Rect& rect);
|
virtual void setFocusRectangle(const Common::Rect& rect);
|
||||||
|
|
||||||
virtual void clearFocusRectangle();
|
virtual void clearFocusRectangle();
|
||||||
|
|
||||||
virtual void initBackend();
|
virtual void initBackend();
|
||||||
|
|
||||||
virtual Graphics::Surface *lockScreen();
|
virtual Graphics::Surface *lockScreen();
|
||||||
virtual void unlockScreen();
|
virtual void unlockScreen();
|
||||||
|
|
||||||
virtual Audio::Mixer* getMixer() { return _mixer; }
|
virtual Audio::Mixer* getMixer() { return _mixer; }
|
||||||
virtual Common::TimerManager* getTimerManager() { return _timer; }
|
virtual Common::TimerManager* getTimerManager() { return _timer; }
|
||||||
static int timerHandler(int t);
|
static int timerHandler(int t);
|
||||||
|
@ -155,8 +155,7 @@ public:
|
||||||
virtual void clearAutoComplete();
|
virtual void clearAutoComplete();
|
||||||
virtual void setCharactersEntered(int count);
|
virtual void setCharactersEntered(int count);
|
||||||
|
|
||||||
|
FilesystemFactory *getFilesystemFactory();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
|
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
|
||||||
|
|
|
@ -37,7 +37,6 @@ extern "C" time_t __wrap_time(time_t* t) {
|
||||||
|
|
||||||
|
|
||||||
time_t DS_time(time_t) {
|
time_t DS_time(time_t) {
|
||||||
consolePrintf("Time!");
|
|
||||||
if (OSystem_DS::instance()) {
|
if (OSystem_DS::instance()) {
|
||||||
return 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);
|
return 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,7 +45,6 @@ time_t DS_time(time_t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t DS_time(long* t) {
|
time_t DS_time(long* t) {
|
||||||
consolePrintf("Time!");
|
|
||||||
if (OSystem_DS::instance()) {
|
if (OSystem_DS::instance()) {
|
||||||
if (t) *t = 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);
|
if (t) *t = 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);
|
||||||
return 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);
|
return 0xABCD1234 + (OSystem_DS::instance()->getMillis() / 1000);
|
||||||
|
|
|
@ -19,10 +19,12 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PORTDEFS_H_
|
#ifndef _PORTDEFS_H_
|
||||||
#define _PORTDEFS_H_
|
#define _PORTDEFS_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
typedef unsigned char u8;
|
typedef unsigned char u8;
|
||||||
typedef signed char s8;
|
typedef signed char s8;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// Save in order 1,2,3,4,larger 2,5
|
// Save in order 1,2,3,4,larger 2,5
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
@ -52,18 +52,18 @@ DSSaveFile::DSSaveFile(SCUMMSave* s, bool compressed, u8* data) {
|
||||||
ownsData = true;
|
ownsData = true;
|
||||||
saveCompressed = false;
|
saveCompressed = false;
|
||||||
// consolePrintf("Decompressed. name=%s size=%d (%d)", save.name, save.size, save.compressedSize);
|
// consolePrintf("Decompressed. name=%s size=%d (%d)", save.name, save.size, save.compressedSize);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ownsData = false;
|
ownsData = false;
|
||||||
origHeader = s;
|
origHeader = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save.magic == (int) 0xBEEFCAFE) {
|
if (save.magic == (int) 0xBEEFCAFE) {
|
||||||
save.isValid = true;
|
save.isValid = true;
|
||||||
} else {
|
} else {
|
||||||
save.isValid = false;
|
save.isValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
isTempFile = false;
|
isTempFile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ DSSaveFile::~DSSaveFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DSSaveFile::loadFromSaveRAM(vu8* address) {
|
bool DSSaveFile::loadFromSaveRAM(vu8* address) {
|
||||||
|
|
||||||
SCUMMSave newSave;
|
SCUMMSave newSave;
|
||||||
|
|
||||||
for (int t = 0; t < (int) sizeof(newSave); t++) {
|
for (int t = 0; t < (int) sizeof(newSave); t++) {
|
||||||
|
@ -89,13 +89,13 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) {
|
||||||
newSave.isValid = true;
|
newSave.isValid = true;
|
||||||
|
|
||||||
*((u16 *) (0x4000204)) |= 0x3;
|
*((u16 *) (0x4000204)) |= 0x3;
|
||||||
|
|
||||||
saveData = new unsigned char[newSave.compressedSize];
|
saveData = new unsigned char[newSave.compressedSize];
|
||||||
|
|
||||||
for (int t = 0; t < (int) newSave.compressedSize; t++) {
|
for (int t = 0; t < (int) newSave.compressedSize; t++) {
|
||||||
((char *) (saveData))[t] = *(address + t + sizeof(newSave));
|
((char *) (saveData))[t] = *(address + t + sizeof(newSave));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ownsData) delete this->saveData;
|
if (ownsData) delete this->saveData;
|
||||||
save = newSave;
|
save = newSave;
|
||||||
saveCompressed = true;
|
saveCompressed = true;
|
||||||
|
@ -105,7 +105,7 @@ bool DSSaveFile::loadFromSaveRAM(vu8* address) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +114,11 @@ void DSSaveFile::compress() {
|
||||||
unsigned char* compBuffer = new unsigned char[(save.size * 110) / 100];
|
unsigned char* compBuffer = new unsigned char[(save.size * 110) / 100];
|
||||||
int compSize = LZ_Compress((u8 *) saveData, compBuffer, save.size);
|
int compSize = LZ_Compress((u8 *) saveData, compBuffer, save.size);
|
||||||
save.compressedSize = compSize;
|
save.compressedSize = compSize;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
delete saveData;
|
delete saveData;
|
||||||
|
|
||||||
// Make the save smaller
|
// Make the save smaller
|
||||||
saveData = (u8 *) realloc(compBuffer, save.compressedSize);
|
saveData = (u8 *) realloc(compBuffer, save.compressedSize);
|
||||||
saveCompressed = true;
|
saveCompressed = true;
|
||||||
|
@ -129,39 +129,39 @@ int DSSaveFile::saveToSaveRAM(vu8* address) {
|
||||||
|
|
||||||
unsigned char* compBuffer;
|
unsigned char* compBuffer;
|
||||||
bool failed;
|
bool failed;
|
||||||
|
|
||||||
|
|
||||||
int compSize;
|
int compSize;
|
||||||
|
|
||||||
compress();
|
compress();
|
||||||
|
|
||||||
compSize = save.compressedSize;
|
compSize = save.compressedSize;
|
||||||
compBuffer = saveData;
|
compBuffer = saveData;
|
||||||
|
|
||||||
if (DSSaveFileManager::instance()->getBytesFree() >= getRamUsage()) {
|
if (DSSaveFileManager::instance()->getBytesFree() >= getRamUsage()) {
|
||||||
|
|
||||||
DSSaveFileManager::instance()->addBytesFree(-getRamUsage());
|
DSSaveFileManager::instance()->addBytesFree(-getRamUsage());
|
||||||
|
|
||||||
// Write header
|
// Write header
|
||||||
for (int t = 0; t < sizeof(save); t++) {
|
for (int t = 0; t < sizeof(save); t++) {
|
||||||
while (*(address + t) != ((char *) (&save))[t]) {
|
while (*(address + t) != ((char *) (&save))[t]) {
|
||||||
*(address + t) = ((char *) (&save))[t];
|
*(address + t) = ((char *) (&save))[t];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write compressed buffer
|
// Write compressed buffer
|
||||||
for (int t = sizeof(save); t < (int) sizeof(save) + compSize; t++) {
|
for (int t = sizeof(save); t < (int) sizeof(save) + compSize; t++) {
|
||||||
while (*(address + t) != compBuffer[t - sizeof(save)]) {
|
while (*(address + t) != compBuffer[t - sizeof(save)]) {
|
||||||
*(address + t) = compBuffer[t - sizeof(save)];
|
*(address + t) = compBuffer[t - sizeof(save)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
failed = false;
|
failed = false;
|
||||||
} else {
|
} else {
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return failed? 0: compSize + sizeof(save);
|
return failed? 0: compSize + sizeof(save);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ uint32 DSSaveFile::read(void *buf, uint32 size) {
|
||||||
}
|
}
|
||||||
memcpy(buf, saveData + ptr, size);
|
memcpy(buf, saveData + ptr, size);
|
||||||
// consolePrintf("byte: %d ", ((u8 *) (buf))[0]);
|
// consolePrintf("byte: %d ", ((u8 *) (buf))[0]);
|
||||||
|
|
||||||
ptr += size;
|
ptr += size;
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ bool DSSaveFile::matches(char* filename) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSSaveFile::setName(char *name) {
|
void DSSaveFile::setName(char *name) {
|
||||||
save.isValid = true;
|
save.isValid = true;
|
||||||
save.magic = 0xBEEFCAFE;
|
save.magic = 0xBEEFCAFE;
|
||||||
|
@ -258,7 +258,7 @@ void DSSaveFile::setName(char *name) {
|
||||||
save.compressedSize = 0;
|
save.compressedSize = 0;
|
||||||
saveData = new unsigned char[DS_MAX_SAVE_SIZE];
|
saveData = new unsigned char[DS_MAX_SAVE_SIZE];
|
||||||
strcpy(save.name, name);
|
strcpy(save.name, name);
|
||||||
|
|
||||||
if ((strstr(name, ".s99")) || (strstr(name, ".c"))) {
|
if ((strstr(name, ".s99")) || (strstr(name, ".c"))) {
|
||||||
isTempFile = true;
|
isTempFile = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -298,10 +298,10 @@ void DSSaveFile::deleteFile() {
|
||||||
|
|
||||||
DSSaveFileManager::DSSaveFileManager() {
|
DSSaveFileManager::DSSaveFileManager() {
|
||||||
instancePtr = this;
|
instancePtr = this;
|
||||||
|
|
||||||
*((u16 *) (0x4000204)) |= 0x3;
|
*((u16 *) (0x4000204)) |= 0x3;
|
||||||
swiWaitForVBlank();
|
swiWaitForVBlank();
|
||||||
|
|
||||||
loadAllFromSRAM();
|
loadAllFromSRAM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ DSSaveFileManager::~DSSaveFileManager() {
|
||||||
|
|
||||||
void DSSaveFileManager::loadAllFromSRAM() {
|
void DSSaveFileManager::loadAllFromSRAM() {
|
||||||
int addr = 1;
|
int addr = 1;
|
||||||
|
|
||||||
for (int r = 0; r < 8; r++) {
|
for (int r = 0; r < 8; r++) {
|
||||||
gbaSave[r].deleteFile();
|
gbaSave[r].deleteFile();
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ void DSSaveFileManager::formatSram() {
|
||||||
for (int r = 0; r < SRAM_SAVE_MAX; r++) {
|
for (int r = 0; r < SRAM_SAVE_MAX; r++) {
|
||||||
*(CART_RAM + r) = 0;
|
*(CART_RAM + r) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadAllFromSRAM();
|
loadAllFromSRAM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ DSSaveFile *DSSaveFileManager::openSavefile(const char* filename, bool saveOrLoa
|
||||||
return gbaSave[r].clone();
|
return gbaSave[r].clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saveOrLoad) {
|
if (saveOrLoad) {
|
||||||
return makeSaveFile(filename, saveOrLoad);
|
return makeSaveFile(filename, saveOrLoad);
|
||||||
} else {
|
} else {
|
||||||
|
@ -401,6 +401,8 @@ Common::StringList DSSaveFileManager::listSavefiles(const char *pattern) {
|
||||||
use Common::matchString from common/util.h and read the Doxygen docs,
|
use Common::matchString from common/util.h and read the Doxygen docs,
|
||||||
then combine this with the old code below...
|
then combine this with the old code below...
|
||||||
*/
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) {
|
void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num) {
|
||||||
|
@ -416,21 +418,20 @@ void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
|
DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
|
||||||
|
|
||||||
// Find a free save slot
|
// Find a free save slot
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
while ((r < 8) && (gbaSave[r].isValid())) {
|
while ((r < 8) && (gbaSave[r].isValid())) {
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r == 8) && (gbaSave[r].isValid())) {
|
if ((r == 8) && (gbaSave[r].isValid())) {
|
||||||
// No more saves
|
// No more saves
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -447,9 +448,9 @@ void DSSaveFileManager::flushToSaveRAM() {
|
||||||
int cartAddr = 1;
|
int cartAddr = 1;
|
||||||
int s;
|
int s;
|
||||||
int extraData = DSSaveFileManager::getExtraData();
|
int extraData = DSSaveFileManager::getExtraData();
|
||||||
|
|
||||||
*((u16 *) (0x4000204)) |= 0x3;
|
*((u16 *) (0x4000204)) |= 0x3;
|
||||||
|
|
||||||
swiWaitForVBlank();
|
swiWaitForVBlank();
|
||||||
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
@ -459,20 +460,20 @@ void DSSaveFileManager::flushToSaveRAM() {
|
||||||
if (!gbaSave[r].isTemp()) size += gbaSave[r].getRamUsage();
|
if (!gbaSave[r].isTemp()) size += gbaSave[r].getRamUsage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size <= SRAM_SAVE_MAX) {
|
if (size <= SRAM_SAVE_MAX) {
|
||||||
|
|
||||||
for (int r = 0; r < SRAM_SAVE_MAX; r++) {
|
for (int r = 0; r < SRAM_SAVE_MAX; r++) {
|
||||||
*(CART_RAM + r) = 0;
|
*(CART_RAM + r) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sramBytesFree = SRAM_SAVE_MAX;
|
sramBytesFree = SRAM_SAVE_MAX;
|
||||||
|
|
||||||
for (int r = 0; (r < 8); r++) {
|
for (int r = 0; (r < 8); r++) {
|
||||||
if (gbaSave[r].isValid() && (!gbaSave[r].isTemp())) {
|
if (gbaSave[r].isValid() && (!gbaSave[r].isTemp())) {
|
||||||
|
|
||||||
cartAddr += s = gbaSave[r].saveToSaveRAM(CART_RAM + cartAddr);
|
cartAddr += s = gbaSave[r].saveToSaveRAM(CART_RAM + cartAddr);
|
||||||
|
|
||||||
/* if (s == 0) {
|
/* if (s == 0) {
|
||||||
consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.", gbaSave[r].getName());
|
consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.", gbaSave[r].getName());
|
||||||
failed = true;
|
failed = true;
|
||||||
|
@ -483,7 +484,7 @@ void DSSaveFileManager::flushToSaveRAM() {
|
||||||
|
|
||||||
consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.");
|
consolePrintf("WARNING: Save didn't fit in cart RAM and has been lost!! Delete files and save again.");
|
||||||
loadAllFromSRAM();
|
loadAllFromSRAM();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DSSaveFileManager::setExtraData(extraData);
|
DSSaveFileManager::setExtraData(extraData);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _RAMSAVE_H_
|
#ifndef _RAMSAVE_H_
|
||||||
#define _RAMSAVE_H_
|
#define _RAMSAVE_H_
|
||||||
|
|
||||||
|
@ -46,56 +46,56 @@ class DSSaveFile : public Common::InSaveFile, public Common::OutSaveFile {
|
||||||
u16 extraMagic; // 32
|
u16 extraMagic; // 32
|
||||||
u32 reserved; // 36
|
u32 reserved; // 36
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
SCUMMSave save;
|
SCUMMSave save;
|
||||||
u8* saveData;
|
u8* saveData;
|
||||||
SCUMMSave* origHeader;
|
SCUMMSave* origHeader;
|
||||||
bool isOpenFlag;
|
bool isOpenFlag;
|
||||||
bool isTempFile;
|
bool isTempFile;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DSSaveFile();
|
DSSaveFile();
|
||||||
DSSaveFile(SCUMMSave* s, bool saveCompressed, u8* data);
|
DSSaveFile(SCUMMSave* s, bool saveCompressed, u8* data);
|
||||||
~DSSaveFile();
|
~DSSaveFile();
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
bool isOpen() const { return isOpenFlag; }
|
bool isOpen() const { return isOpenFlag; }
|
||||||
virtual bool eos() const;
|
virtual bool eos() const;
|
||||||
virtual void skip(uint32 size);
|
virtual void skip(uint32 size);
|
||||||
|
|
||||||
virtual uint32 pos() const;
|
virtual uint32 pos() const;
|
||||||
virtual uint32 size() const;
|
virtual uint32 size() const;
|
||||||
virtual void seek(int32 pos, int whence);
|
virtual void seek(int32 pos, int whence);
|
||||||
|
|
||||||
uint32 read(void *buf, uint32 size);
|
uint32 read(void *buf, uint32 size);
|
||||||
uint32 write(const void *buf, uint32 size);
|
uint32 write(const void *buf, uint32 size);
|
||||||
|
|
||||||
void setName(char *name);
|
void setName(char *name);
|
||||||
char* getName() { return save.name; }
|
char* getName() { return save.name; }
|
||||||
|
|
||||||
bool isValid() { return save.isValid; }
|
bool isValid() { return save.isValid; }
|
||||||
bool isTemp() { return isTempFile; }
|
bool isTemp() { return isTempFile; }
|
||||||
bool matches(char* prefix, int num);
|
bool matches(char* prefix, int num);
|
||||||
bool matches(char* filename);
|
bool matches(char* filename);
|
||||||
|
|
||||||
void clearData();
|
void clearData();
|
||||||
void compress();
|
void compress();
|
||||||
|
|
||||||
int getRamUsage() { return sizeof(save) + save.compressedSize; }
|
int getRamUsage() { return sizeof(save) + save.compressedSize; }
|
||||||
char* getRamImage() { return (char *) &save; }
|
char* getRamImage() { return (char *) &save; }
|
||||||
|
|
||||||
int getSize() { return save.size; }
|
int getSize() { return save.size; }
|
||||||
|
|
||||||
DSSaveFile* clone();
|
DSSaveFile* clone();
|
||||||
|
|
||||||
bool loadFromSaveRAM(vu8* address);
|
bool loadFromSaveRAM(vu8* address);
|
||||||
int saveToSaveRAM(vu8* address);
|
int saveToSaveRAM(vu8* address);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void deleteFile();
|
void deleteFile();
|
||||||
|
|
||||||
void operator delete(void *p) {
|
void operator delete(void *p) {
|
||||||
// consolePrintf("Finished! size=%d\n", ((DSSaveFile *) (p))->save->size);
|
// consolePrintf("Finished! size=%d\n", ((DSSaveFile *) (p))->save->size);
|
||||||
}
|
}
|
||||||
|
@ -107,25 +107,25 @@ public:
|
||||||
|
|
||||||
|
|
||||||
class DSSaveFileManager : public Common::SaveFileManager {
|
class DSSaveFileManager : public Common::SaveFileManager {
|
||||||
|
|
||||||
DSSaveFile gbaSave[8];
|
DSSaveFile gbaSave[8];
|
||||||
static DSSaveFileManager* instancePtr;
|
static DSSaveFileManager* instancePtr;
|
||||||
int sramBytesFree;
|
int sramBytesFree;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DSSaveFileManager();
|
DSSaveFileManager();
|
||||||
~DSSaveFileManager();
|
~DSSaveFileManager();
|
||||||
|
|
||||||
static DSSaveFileManager* instance() { return instancePtr; }
|
static DSSaveFileManager* instance() { return instancePtr; }
|
||||||
|
|
||||||
DSSaveFile *openSavefile(const char *filename, bool saveOrLoad);
|
DSSaveFile *openSavefile(const char *filename, bool saveOrLoad);
|
||||||
|
|
||||||
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
|
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
|
||||||
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
|
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
|
||||||
|
|
||||||
virtual bool removeSavefile(const char *filename);
|
virtual bool removeSavefile(const char *filename);
|
||||||
virtual Common::StringList listSavefiles(const char *pattern);
|
virtual Common::StringList listSavefiles(const char *pattern);
|
||||||
|
|
||||||
void flushToSaveRAM();
|
void flushToSaveRAM();
|
||||||
|
|
||||||
void addBytesFree(int size) { sramBytesFree += size; }
|
void addBytesFree(int size) { sramBytesFree += size; }
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
void deleteFile(char* name);
|
void deleteFile(char* name);
|
||||||
void listFiles();
|
void listFiles();
|
||||||
void formatSram();
|
void formatSram();
|
||||||
|
|
||||||
void loadAllFromSRAM();
|
void loadAllFromSRAM();
|
||||||
|
|
||||||
static bool isExtraDataPresent();
|
static bool isExtraDataPresent();
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
//
|
//
|
||||||
// Changelog:
|
// Changelog:
|
||||||
// 0.1: First version
|
// 0.1: First version
|
||||||
// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
|
// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
|
||||||
// Changed some register defines for consistency.
|
// Changed some register defines for consistency.
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
@ -52,7 +52,7 @@ u16* fontMap;
|
||||||
u8 row, col;
|
u8 row, col;
|
||||||
|
|
||||||
//font may not start on a character base boundry
|
//font may not start on a character base boundry
|
||||||
u16 fontOffset;
|
u16 fontOffset;
|
||||||
|
|
||||||
//the first character in the set (0 if you have a full set)
|
//the first character in the set (0 if you have a full set)
|
||||||
u16 fontStart;
|
u16 fontStart;
|
||||||
|
@ -65,7 +65,7 @@ u16 fontPal;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
//consoleInit
|
//consoleInit
|
||||||
// param:
|
// param:
|
||||||
// font: 16 color font
|
// font: 16 color font
|
||||||
// charBase: the location the font data will be loaded to
|
// charBase: the location the font data will be loaded to
|
||||||
// numCharacters: count of characters in the font
|
// numCharacters: count of characters in the font
|
||||||
|
@ -79,7 +79,7 @@ void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16*
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
row = col = 0;
|
row = col = 0;
|
||||||
|
|
||||||
fontStart = charStart;
|
fontStart = charStart;
|
||||||
|
|
||||||
fontOffset = 0;
|
fontOffset = 0;
|
||||||
|
@ -111,9 +111,9 @@ void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16*
|
||||||
temp |= 0xF00;
|
temp |= 0xF00;
|
||||||
if(font[i] & 0xF000)
|
if(font[i] & 0xF000)
|
||||||
temp |= 0xF000;
|
temp |= 0xF000;
|
||||||
|
|
||||||
charBase[i] = temp;
|
charBase[i] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//end if bitdepth
|
}//end if bitdepth
|
||||||
else
|
else
|
||||||
|
@ -140,7 +140,7 @@ void consoleInit(u16* font, u16* charBase, u16 numCharacters, u8 charStart, u16*
|
||||||
|
|
||||||
void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth)
|
void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth)
|
||||||
{
|
{
|
||||||
consoleInit((u16 *) default_font_bin, charBase, 128, 0, map, CONSOLE_USE_COLOR255, bitDepth);
|
consoleInit((u16 *) default_font_bin, charBase, 128, 0, map, CONSOLE_USE_COLOR255, bitDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void consolePrintSet(int x, int y)
|
void consolePrintSet(int x, int y)
|
||||||
|
@ -164,9 +164,9 @@ void consolePrintChar(char c)
|
||||||
{
|
{
|
||||||
col = 0;
|
col = 0;
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(row >= CONSOLE_HEIGHT)
|
if(row >= CONSOLE_HEIGHT)
|
||||||
{
|
{
|
||||||
row--;
|
row--;
|
||||||
|
@ -178,7 +178,7 @@ void consolePrintChar(char c)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(c)
|
switch(c)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ void consolePrintChar(char c)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,16 +207,16 @@ void printX(int w, unsigned d)
|
||||||
{
|
{
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
char buf[20] = {0};
|
char buf[20] = {0};
|
||||||
|
|
||||||
|
|
||||||
while(d > 0)
|
while(d > 0)
|
||||||
{
|
{
|
||||||
buf[loop++] = d & 0xF;
|
buf[loop++] = d & 0xF;
|
||||||
d = d>>4;
|
d = d>>4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 7; i >= 0; i--)
|
for (i = 7; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if(buf[i] || i < loop)
|
if(buf[i] || i < loop)
|
||||||
|
@ -235,15 +235,15 @@ void printx(int w, unsigned int d)
|
||||||
{
|
{
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
char buf[20] = {0};
|
char buf[20] = {0};
|
||||||
|
|
||||||
while(d > 0)
|
while(d > 0)
|
||||||
{
|
{
|
||||||
buf[loop++] = d & 0xF;
|
buf[loop++] = d & 0xF;
|
||||||
d = d>>4;
|
d = d>>4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 7; i >= 0; i--)
|
for (i = 7; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if(buf[i] || i < loop)
|
if(buf[i] || i < loop)
|
||||||
|
@ -262,8 +262,8 @@ void printInt(int w, int d)
|
||||||
{
|
{
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
char buf[20] = {0};
|
char buf[20] = {0};
|
||||||
|
|
||||||
if(d < 0)
|
if(d < 0)
|
||||||
{
|
{
|
||||||
|
@ -276,9 +276,9 @@ void printInt(int w, int d)
|
||||||
else while (d > 0)
|
else while (d > 0)
|
||||||
{
|
{
|
||||||
buf[loop++] = d % 10;
|
buf[loop++] = d % 10;
|
||||||
d /= 10;
|
d /= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 7; i >= 0; i--)
|
for (i = 7; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if(buf[i] || i < loop)
|
if(buf[i] || i < loop)
|
||||||
|
@ -310,16 +310,16 @@ void print0X(int w, unsigned d)
|
||||||
{
|
{
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
char buf[] = {0,0,0,0,0,0,0,0}; //set to zero cause I may add formatted output someday
|
char buf[] = {0,0,0,0,0,0,0,0}; //set to zero cause I may add formatted output someday
|
||||||
|
|
||||||
|
|
||||||
while(d > 0)
|
while(d > 0)
|
||||||
{
|
{
|
||||||
buf[loop++] = d & 0xF;
|
buf[loop++] = d & 0xF;
|
||||||
d = d>>4;
|
d = d>>4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 7; i >= 0; i--)
|
for (i = 7; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if(buf[i] || i < w || i < loop)
|
if(buf[i] || i < w || i < loop)
|
||||||
|
@ -336,16 +336,16 @@ void print0x(int w, unsigned int d)
|
||||||
{
|
{
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
char buf[] = {0,0,0,0,0,0,0,0}; //set to zero cause I may add formatted output someday
|
char buf[] = {0,0,0,0,0,0,0,0}; //set to zero cause I may add formatted output someday
|
||||||
|
|
||||||
|
|
||||||
while(d > 0)
|
while(d > 0)
|
||||||
{
|
{
|
||||||
buf[loop++] = d & 0xF;
|
buf[loop++] = d & 0xF;
|
||||||
d = d>>4;
|
d = d>>4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 7; i >= 0; i--)
|
for (i = 7; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if(buf[i] || i < w || i < loop)
|
if(buf[i] || i < w || i < loop)
|
||||||
|
@ -362,9 +362,9 @@ void print0Int(int w, int d)
|
||||||
{
|
{
|
||||||
int loop = 0;
|
int loop = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
char buf[] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; //set to zero cause I may add formatted output someday
|
char buf[] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; //set to zero cause I may add formatted output someday
|
||||||
|
|
||||||
if(d < 0)
|
if(d < 0)
|
||||||
{
|
{
|
||||||
consolePrintChar('-');
|
consolePrintChar('-');
|
||||||
|
@ -374,9 +374,9 @@ void print0Int(int w, int d)
|
||||||
while(d > 0)
|
while(d > 0)
|
||||||
{
|
{
|
||||||
buf[loop++] = d % 10;
|
buf[loop++] = d % 10;
|
||||||
d /= 10;
|
d /= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 15; i >= 0; i--)
|
for (i = 15; i >= 0; i--)
|
||||||
if(buf[i] || i < w || i < loop)
|
if(buf[i] || i < w || i < loop)
|
||||||
consolePrintChar(buf[i] + '0');
|
consolePrintChar(buf[i] + '0');
|
||||||
|
@ -414,14 +414,14 @@ void printF(int w, float f)
|
||||||
|
|
||||||
if(*t & BIT(31))
|
if(*t & BIT(31))
|
||||||
consolePrintChar('-');
|
consolePrintChar('-');
|
||||||
|
|
||||||
|
|
||||||
print0Bin(32, fraction);
|
print0Bin(32, fraction);
|
||||||
|
|
||||||
printInt(1, fraction);
|
printInt(1, fraction);
|
||||||
consolePrintChar('e');
|
consolePrintChar('e');
|
||||||
printInt(1, exp - 127);
|
printInt(1, exp - 127);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if(exp == 0 && fraction == 0)
|
if(exp == 0 && fraction == 0)
|
||||||
{
|
{
|
||||||
|
@ -447,7 +447,7 @@ void consolePrintf(const char* s, ...)
|
||||||
va_list argp;
|
va_list argp;
|
||||||
|
|
||||||
va_start(argp, s);
|
va_start(argp, s);
|
||||||
|
|
||||||
|
|
||||||
while(*s)
|
while(*s)
|
||||||
{
|
{
|
||||||
|
@ -474,7 +474,7 @@ void consolePrintf(const char* s, ...)
|
||||||
case 'I':
|
case 'I':
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
if(z)print0Int(w, va_arg(argp, int));
|
if(z)print0Int(w, va_arg(argp, int));
|
||||||
else printInt(w, va_arg(argp, int));
|
else printInt(w, va_arg(argp, int));
|
||||||
s++;
|
s++;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
//
|
//
|
||||||
// Changelog:
|
// Changelog:
|
||||||
// 0.1: First version
|
// 0.1: First version
|
||||||
// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
|
// 0.2: Fixed sprite mapping bug. 1D mapping should work now.
|
||||||
// Changed some register defines for consistency.
|
// Changed some register defines for consistency.
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "scummhelp.h"
|
#include "scummhelp.h"
|
||||||
|
|
||||||
#define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while (0)
|
#define ADD_BIND(k,d) do { key[i] = k; dsc[i] = d; i++; } while (0)
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCUMMHELP_H_
|
#ifndef _SCUMMHELP_H_
|
||||||
#define _SCUMMHELP_H_
|
#define _SCUMMHELP_H_
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace DS {
|
||||||
|
|
||||||
void updateStrings(byte gameId, byte version, Common::Platform platform,
|
void updateStrings(byte gameId, byte version, Common::Platform platform,
|
||||||
int page, Common::String &title, Common::String *&key, Common::String *&dsc);
|
int page, Common::String &title, Common::String *&key, Common::String *&dsc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct key_data {
|
||||||
|
|
||||||
key_data keys[DS_NUM_KEYS] = {
|
key_data keys[DS_NUM_KEYS] = {
|
||||||
// Key number x y character
|
// Key number x y character
|
||||||
|
|
||||||
// Numbers
|
// Numbers
|
||||||
{28, 3, 0, '1'},
|
{28, 3, 0, '1'},
|
||||||
{29, 5, 0, '2'},
|
{29, 5, 0, '2'},
|
||||||
|
@ -116,7 +116,7 @@ key_data keys[DS_NUM_KEYS] = {
|
||||||
{54, 29, 8, Common::KEYCODE_DOWN},
|
{54, 29, 8, Common::KEYCODE_DOWN},
|
||||||
{53, 31, 8, Common::KEYCODE_RIGHT},
|
{53, 31, 8, Common::KEYCODE_RIGHT},
|
||||||
{51, 29, 6, Common::KEYCODE_UP},
|
{51, 29, 6, Common::KEYCODE_UP},
|
||||||
|
|
||||||
// Close button
|
// Close button
|
||||||
{56, 30, 0, Common::KEYCODE_INVALID},
|
{56, 30, 0, Common::KEYCODE_INVALID},
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ key_data keys[DS_NUM_KEYS] = {
|
||||||
{66, 26, -2, Common::KEYCODE_F10},
|
{66, 26, -2, Common::KEYCODE_F10},
|
||||||
{67, 28, -2, Common::KEYCODE_F11},
|
{67, 28, -2, Common::KEYCODE_F11},
|
||||||
{68, 30, -2, Common::KEYCODE_F12},
|
{68, 30, -2, Common::KEYCODE_F12},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int keyboardX;
|
int keyboardX;
|
||||||
|
@ -162,7 +162,7 @@ void restoreVRAM(int tileBase, int mapBase, u16* saveSpace) {
|
||||||
/* for (int r = 0; r < 32 * 32; r++) {
|
/* for (int r = 0; r < 32 * 32; r++) {
|
||||||
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++;
|
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = *saveSpace++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int r = 0; r < 4096; r++) {
|
for (int r = 0; r < 4096; r++) {
|
||||||
((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = *saveSpace++;
|
((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = *saveSpace++;
|
||||||
}*/
|
}*/
|
||||||
|
@ -175,77 +175,77 @@ void drawKeyboard(int tileBase, int mapBase, u16* saveSpace) {
|
||||||
// *saveSpace++ = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r];
|
// *saveSpace++ = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r];
|
||||||
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = 0;
|
((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase))[r] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int r = 0; r < KEYBOARD_DATA_SIZE / 2; r++) {
|
for (int r = 0; r < KEYBOARD_DATA_SIZE / 2; r++) {
|
||||||
// *saveSpace++ = ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r];
|
// *saveSpace++ = ((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r];
|
||||||
((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = ((u16 *) (keyboard_raw))[r];
|
((u16 *) CHAR_BASE_BLOCK_SUB(tileBase))[r] = ((u16 *) (keyboard_raw))[r];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int r = 0; r < 16; r++) {
|
for (int r = 0; r < 16; r++) {
|
||||||
BG_PALETTE_SUB[r] = ((u16 *) (keyboard_pal_raw))[r];
|
BG_PALETTE_SUB[r] = ((u16 *) (keyboard_pal_raw))[r];
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is the font
|
// this is the font
|
||||||
for (int tile = 0; tile < 94; tile++) {
|
for (int tile = 0; tile < 94; tile++) {
|
||||||
|
|
||||||
u16* tileAddr = (u16 *) (CHAR_BASE_BLOCK_SUB(tileBase) + ((KEYBOARD_DATA_SIZE) + (tile * 32)));
|
u16* tileAddr = (u16 *) (CHAR_BASE_BLOCK_SUB(tileBase) + ((KEYBOARD_DATA_SIZE) + (tile * 32)));
|
||||||
u8* src = ((u8 *) (_8x8font_tga_raw)) + 18 + tile * 8;
|
u8* src = ((u8 *) (_8x8font_tga_raw)) + 18 + tile * 8;
|
||||||
|
|
||||||
for (int y = 0 ; y < 8; y++) {
|
for (int y = 0 ; y < 8; y++) {
|
||||||
for (int x = 0; x < 2; x++) {
|
for (int x = 0; x < 2; x++) {
|
||||||
*(tileAddr + (y * 2) + x) =(*(src + (y * 752) + (x * 4) + 0) & 0x0F)
|
*(tileAddr + (y * 2) + x) =(*(src + (y * 752) + (x * 4) + 0) & 0x0F)
|
||||||
| ((*(src + (y * 752) + (x * 4) + 1) & 0x0F) << 4)
|
| ((*(src + (y * 752) + (x * 4) + 1) & 0x0F) << 4)
|
||||||
| ((*(src + (y * 752) + (x * 4) + 2) & 0x0F) << 8)
|
| ((*(src + (y * 752) + (x * 4) + 2) & 0x0F) << 8)
|
||||||
| ((*(src + (y * 752) + (x * 4) + 3) & 0x0F) << 12);
|
| ((*(src + (y * 752) + (x * 4) + 3) & 0x0F) << 12);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int r = 0; r < 16; r++) {
|
for (int r = 0; r < 16; r++) {
|
||||||
int col = ((u16 *) (keyboard_pal_raw))[r];
|
int col = ((u16 *) (keyboard_pal_raw))[r];
|
||||||
|
|
||||||
int red = col & 0x001F;
|
int red = col & 0x001F;
|
||||||
int green = (col & 0x03E0) >> 5;
|
int green = (col & 0x03E0) >> 5;
|
||||||
int blue = (col & 0x7C00) >> 10;
|
int blue = (col & 0x7C00) >> 10;
|
||||||
|
|
||||||
red = (red * 8) / 16;
|
red = (red * 8) / 16;
|
||||||
green = (green * 24) / 16;
|
green = (green * 24) / 16;
|
||||||
blue = (blue * 8) / 16;
|
blue = (blue * 8) / 16;
|
||||||
|
|
||||||
if (green > 31) green = 31;
|
if (green > 31) green = 31;
|
||||||
|
|
||||||
BG_PALETTE_SUB[16 + r] = red | (green << 5) | (blue << 10);
|
BG_PALETTE_SUB[16 + r] = red | (green << 5) | (blue << 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboardX = -2;
|
keyboardX = -2;
|
||||||
keyboardY = 2;
|
keyboardY = 2;
|
||||||
|
|
||||||
DS::mapBase = mapBase;
|
DS::mapBase = mapBase;
|
||||||
DS::tileBase = tileBase;
|
DS::tileBase = tileBase;
|
||||||
|
|
||||||
shiftState = false;
|
shiftState = false;
|
||||||
capsLockState = false;
|
capsLockState = false;
|
||||||
|
|
||||||
int x = keyboardX;
|
int x = keyboardX;
|
||||||
int y = keyboardY;
|
int y = keyboardY;
|
||||||
|
|
||||||
u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase));
|
u16* base = ((u16 *) SCREEN_BASE_BLOCK_SUB(mapBase));
|
||||||
baseAddress = base;
|
baseAddress = base;
|
||||||
|
|
||||||
for (int r = 0; r < DS_NUM_KEYS; r++) {
|
for (int r = 0; r < DS_NUM_KEYS; r++) {
|
||||||
base[(y + keys[r].y) * 32 + x + keys[r].x] = 10 + keys[r].keyNum * 2;
|
base[(y + keys[r].y) * 32 + x + keys[r].x] = 10 + keys[r].keyNum * 2;
|
||||||
base[(y + keys[r].y) * 32 + x + keys[r].x + 1] = 10 + keys[r].keyNum * 2 + 1;
|
base[(y + keys[r].y) * 32 + x + keys[r].x + 1] = 10 + keys[r].keyNum * 2 + 1;
|
||||||
|
|
||||||
base[(y + keys[r].y + 1) * 32 + x + keys[r].x] = 10 + 148 + keys[r].keyNum * 2;
|
base[(y + keys[r].y + 1) * 32 + x + keys[r].x] = 10 + 148 + keys[r].keyNum * 2;
|
||||||
base[(y + keys[r].y + 1) * 32 + x + keys[r].x + 1] = 10 + 148 + keys[r].keyNum * 2 + 1;
|
base[(y + keys[r].y + 1) * 32 + x + keys[r].x + 1] = 10 + 148 + keys[r].keyNum * 2 + 1;
|
||||||
|
|
||||||
keys[r].pressed = false;
|
keys[r].pressed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
closed = false;
|
closed = false;
|
||||||
clearAutoComplete();
|
clearAutoComplete();
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ void drawAutoComplete() {
|
||||||
baseAddress[y * 32 + x] = 0;
|
baseAddress[y * 32 + x] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int r = 0; r < autoCompleteCount; r++) {
|
for (int r = 0; r < autoCompleteCount; r++) {
|
||||||
int y = 12 + (r % 6) * 2;
|
int y = 12 + (r % 6) * 2;
|
||||||
|
@ -265,15 +265,15 @@ void drawAutoComplete() {
|
||||||
|
|
||||||
for (int p = 0; p < strlen(autoCompleteWord[r]); p++) {
|
for (int p = 0; p < strlen(autoCompleteWord[r]); p++) {
|
||||||
char c = autoCompleteWord[r][p];
|
char c = autoCompleteWord[r][p];
|
||||||
|
|
||||||
int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
|
int tile = c - 33 + (KEYBOARD_DATA_SIZE / 32);
|
||||||
|
|
||||||
if (selectedCompletion == r) {
|
if (selectedCompletion == r) {
|
||||||
tile |= 0x1000;
|
tile |= 0x1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
baseAddress[y * 32 + x + p] = tile;
|
baseAddress[y * 32 + x + p] = tile;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ void clearAutoComplete() {
|
||||||
|
|
||||||
void typeCompletion(int current) {
|
void typeCompletion(int current) {
|
||||||
Common::Event event;
|
Common::Event event;
|
||||||
OSystem_DS* system = OSystem_DS::instance();
|
OSystem_DS* system = OSystem_DS::instance();
|
||||||
|
|
||||||
strcat(autoCompleteBuffer, &autoCompleteWord[current][charactersEntered]);
|
strcat(autoCompleteBuffer, &autoCompleteWord[current][charactersEntered]);
|
||||||
strcat(autoCompleteBuffer, " ");
|
strcat(autoCompleteBuffer, " ");
|
||||||
|
@ -330,7 +330,7 @@ void typeCompletion(int current) {
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
event.type = Common::EVENT_KEYDOWN;
|
||||||
event.kbd.flags = 0;
|
event.kbd.flags = 0;
|
||||||
system->addEvent(event);
|
system->addEvent(event);
|
||||||
|
|
||||||
event.type = Common::EVENT_KEYUP;
|
event.type = Common::EVENT_KEYUP;
|
||||||
system->addEvent(event);
|
system->addEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -350,14 +350,14 @@ void updateTypeEvents()
|
||||||
if (autoCompleteBuffer[0] != '\0')
|
if (autoCompleteBuffer[0] != '\0')
|
||||||
{
|
{
|
||||||
Common::Event event;
|
Common::Event event;
|
||||||
OSystem_DS* system = OSystem_DS::instance();
|
OSystem_DS* system = OSystem_DS::instance();
|
||||||
|
|
||||||
event.kbd.keycode = (Common::KeyCode) autoCompleteBuffer[0];
|
event.kbd.keycode = (Common::KeyCode) autoCompleteBuffer[0];
|
||||||
event.kbd.ascii = autoCompleteBuffer[0];
|
event.kbd.ascii = autoCompleteBuffer[0];
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
event.type = Common::EVENT_KEYDOWN;
|
||||||
event.kbd.flags = 0;
|
event.kbd.flags = 0;
|
||||||
system->addEvent(event);
|
system->addEvent(event);
|
||||||
|
|
||||||
event.type = Common::EVENT_KEYUP;
|
event.type = Common::EVENT_KEYUP;
|
||||||
system->addEvent(event);
|
system->addEvent(event);
|
||||||
|
|
||||||
|
@ -380,30 +380,37 @@ void createKeyEvent(int keyNum, Common::Event& event)
|
||||||
} else {
|
} else {
|
||||||
event.kbd.keycode = (Common::KeyCode) (Common::KEYCODE_F1 - (keys[keyNum].character - '1'));
|
event.kbd.keycode = (Common::KeyCode) (Common::KEYCODE_F1 - (keys[keyNum].character - '1'));
|
||||||
event.kbd.ascii = 0;
|
event.kbd.ascii = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((keys[keyNum].character >= 'A') && (keys[keyNum].character <= 'Z')) {
|
} else if ((keys[keyNum].character >= 'A') && (keys[keyNum].character <= 'Z')) {
|
||||||
|
|
||||||
if ((!DS::shiftState) && (!DS::capsLockState)) {
|
if ((!DS::shiftState) && (!DS::capsLockState)) {
|
||||||
event.kbd.ascii = keys[keyNum].character + 32; // Make key lowercase.
|
event.kbd.ascii = keys[keyNum].character + 32; // Make key lowercase.
|
||||||
} else {
|
} else {
|
||||||
event.kbd.ascii = keys[keyNum].character;
|
event.kbd.ascii = keys[keyNum].character;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.kbd.keycode = (Common::KeyCode) event.kbd.ascii;
|
event.kbd.keycode = (Common::KeyCode) event.kbd.ascii;
|
||||||
} else {
|
} else {
|
||||||
event.kbd.ascii = keys[keyNum].character;
|
if ((keys[keyNum].character >= Common::KEYCODE_F1) && (keys[keyNum].character >= Common::KEYCODE_F12)) {
|
||||||
event.kbd.keycode = (Common::KeyCode) keys[keyNum].character;
|
event.kbd.keycode = (Common::KeyCode) keys[keyNum].character;
|
||||||
}
|
event.kbd.ascii = keys[keyNum].character - Common::KEYCODE_F1 + Common::ASCII_F1;
|
||||||
|
} else {
|
||||||
|
event.kbd.ascii = keys[keyNum].character;
|
||||||
|
event.kbd.keycode = (Common::KeyCode) keys[keyNum].character;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addKeyboardEvents() {
|
void addKeyboardEvents() {
|
||||||
|
bool resetShift = false;
|
||||||
|
|
||||||
updateTypeEvents();
|
updateTypeEvents();
|
||||||
|
|
||||||
if (DS::getPenDown()) {
|
if (DS::getPenDown()) {
|
||||||
int x = IPC->touchXpx;
|
int x = IPC->touchXpx;
|
||||||
int y = IPC->touchYpx;
|
int y = IPC->touchYpx;
|
||||||
|
|
||||||
int tx = (x >> 3);
|
int tx = (x >> 3);
|
||||||
int ty = (y >> 3);
|
int ty = (y >> 3);
|
||||||
|
|
||||||
|
@ -427,81 +434,89 @@ void addKeyboardEvents() {
|
||||||
|
|
||||||
tx -= keyboardX;
|
tx -= keyboardX;
|
||||||
ty -= keyboardY;
|
ty -= keyboardY;
|
||||||
|
|
||||||
// consolePrintf("x=%d y=%d\n", tx, ty);
|
// consolePrintf("x=%d y=%d\n", tx, ty);
|
||||||
|
|
||||||
for (int r = 0; r < DS_NUM_KEYS; r++) {
|
for (int r = 0; r < DS_NUM_KEYS; r++) {
|
||||||
if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) &&
|
if (( (tx >= keys[r].x) && (tx <= keys[r].x + 1)) &&
|
||||||
(ty >= keys[r].y) && (ty <= keys[r].y + 1)) {
|
(ty >= keys[r].y) && (ty <= keys[r].y + 1)) {
|
||||||
OSystem_DS* system = OSystem_DS::instance();
|
OSystem_DS* system = OSystem_DS::instance();
|
||||||
Common::Event event;
|
Common::Event event;
|
||||||
|
|
||||||
// consolePrintf("Key: %d\n", r);
|
// consolePrintf("Key: %d\n", r);
|
||||||
if ((keys[r].character == Common::KEYCODE_INVALID)) {
|
if ((keys[r].character == Common::KEYCODE_INVALID)) {
|
||||||
// Close button
|
// Close button
|
||||||
DS::closed = true;
|
DS::closed = true;
|
||||||
} else {
|
} else {
|
||||||
createKeyEvent(r, event);
|
createKeyEvent(r, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//event.kbd.keycode = keys[r].character;
|
//event.kbd.keycode = keys[r].character;
|
||||||
//event.kbd.ascii = keys[r].character;
|
//event.kbd.ascii = keys[r].character;
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
event.type = Common::EVENT_KEYDOWN;
|
||||||
system->addEvent(event);
|
system->addEvent(event);
|
||||||
|
|
||||||
// event.type = Common::EVENT_KEYUP;
|
// event.type = Common::EVENT_KEYUP;
|
||||||
// system->addEvent(event);
|
// system->addEvent(event);
|
||||||
|
|
||||||
switch (keys[r].character) {
|
switch (keys[r].character) {
|
||||||
case DS_SHIFT: {
|
case DS_SHIFT: {
|
||||||
DS::shiftState = !DS::shiftState;
|
DS::shiftState = !DS::shiftState;
|
||||||
DS::setKeyHighlight(r, DS::shiftState);
|
DS::setKeyHighlight(r, DS::shiftState);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DS_CAPSLOCK: {
|
case DS_CAPSLOCK: {
|
||||||
DS::capsLockState = !DS::capsLockState;
|
DS::capsLockState = !DS::capsLockState;
|
||||||
DS::setKeyHighlight(r, DS::capsLockState);
|
DS::setKeyHighlight(r, DS::capsLockState);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
DS::setKeyHighlight(r, true);
|
DS::setKeyHighlight(r, true);
|
||||||
keys[r].pressed = true;
|
keys[r].pressed = true;
|
||||||
|
|
||||||
if (DS::shiftState) {
|
|
||||||
DS::shiftState = false;
|
|
||||||
for (int t = 0; t < DS_NUM_KEYS; t++) {
|
|
||||||
if (keys[t].character == DS_SHIFT) {
|
|
||||||
DS::setKeyHighlight(t, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DS::getPenReleased()) {
|
if (DS::getPenReleased()) {
|
||||||
|
|
||||||
for (int r = 0; r < DS_NUM_KEYS; r++) {
|
for (int r = 0; r < DS_NUM_KEYS; r++) {
|
||||||
if (keys[r].pressed) {
|
if (keys[r].pressed) {
|
||||||
DS::setKeyHighlight(r, false);
|
DS::setKeyHighlight(r, false);
|
||||||
|
|
||||||
OSystem_DS* system = OSystem_DS::instance();
|
OSystem_DS* system = OSystem_DS::instance();
|
||||||
|
|
||||||
Common::Event event;
|
Common::Event event;
|
||||||
createKeyEvent(r, event);
|
createKeyEvent(r, event);
|
||||||
event.type = Common::EVENT_KEYUP;
|
event.type = Common::EVENT_KEYUP;
|
||||||
system->addEvent(event);
|
system->addEvent(event);
|
||||||
|
|
||||||
keys[r].pressed = false;
|
keys[r].pressed = false;
|
||||||
|
|
||||||
|
if (keys[r].character != DS_SHIFT) {
|
||||||
|
resetShift = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((resetShift) && (DS::shiftState)) {
|
||||||
|
DS::shiftState = false;
|
||||||
|
resetShift = false;
|
||||||
|
for (int t = 0; t < DS_NUM_KEYS; t++) {
|
||||||
|
if (keys[t].character == DS_SHIFT) {
|
||||||
|
DS::setKeyHighlight(t, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TOUCHKEYBOARD_H_
|
#ifndef _TOUCHKEYBOARD_H_
|
||||||
#define _TOUCHKEYBOARD_H_
|
#define _TOUCHKEYBOARD_H_
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ void addAutoCompleteLine(char* line) {
|
||||||
{
|
{
|
||||||
char word[32];
|
char word[32];
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
// Skip the T9-style numbers
|
// Skip the T9-style numbers
|
||||||
while (*line != ' ')
|
while (*line != ' ')
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ void addAutoCompleteLine(char* line) {
|
||||||
if (*line == ' ') line++;
|
if (*line == ' ') line++;
|
||||||
|
|
||||||
|
|
||||||
// Copy the new word
|
// Copy the new word
|
||||||
do {
|
do {
|
||||||
word[length++] = *line++;
|
word[length++] = *line++;
|
||||||
} while ((*line != '\0') && (*line != ' ') && (*line != '\n'));
|
} while ((*line != '\0') && (*line != ' ') && (*line != '\n'));
|
||||||
|
@ -47,7 +47,7 @@ void addAutoCompleteLine(char* line) {
|
||||||
|
|
||||||
// Store a pointer to the start of the word
|
// Store a pointer to the start of the word
|
||||||
wordBufferPtr[wordBufferPtrPos++] = &wordBuffer[wordBufferPos];
|
wordBufferPtr[wordBufferPtrPos++] = &wordBuffer[wordBufferPos];
|
||||||
|
|
||||||
// copy the new word into the buffer
|
// copy the new word into the buffer
|
||||||
strcpy(&wordBuffer[wordBufferPos], word);
|
strcpy(&wordBuffer[wordBufferPos], word);
|
||||||
wordBufferPos += strlen(word) + 1;
|
wordBufferPos += strlen(word) + 1;
|
||||||
|
@ -104,11 +104,11 @@ bool findWordCompletions(char* input)
|
||||||
// Get the word from the dictonary line
|
// Get the word from the dictonary line
|
||||||
word = wordBufferPtr[position];
|
word = wordBufferPtr[position];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Now check to see if the word is before or after the stub we're after
|
// Now check to see if the word is before or after the stub we're after
|
||||||
int result = scumm_stricmp((const char *) partialWord, (const char *) word);
|
int result = scumm_stricmp((const char *) partialWord, (const char *) word);
|
||||||
|
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
// We've found the whole word. Aren't we good.
|
// We've found the whole word. Aren't we good.
|
||||||
break;
|
break;
|
||||||
|
@ -128,10 +128,10 @@ bool findWordCompletions(char* input)
|
||||||
word = wordBufferPtr[position];
|
word = wordBufferPtr[position];
|
||||||
//consolePrintf("Final word: %s\n", word);
|
//consolePrintf("Final word: %s\n", word);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
system->setCharactersEntered(strlen(partialWord));
|
system->setCharactersEntered(strlen(partialWord));
|
||||||
|
|
||||||
|
|
||||||
bool match = true;
|
bool match = true;
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ bool findWordCompletions(char* input)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
system->addAutoComplete(word);
|
system->addAutoComplete(word);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,25 +29,25 @@
|
||||||
|
|
||||||
ZipFile::ZipFile() {
|
ZipFile::ZipFile() {
|
||||||
// Locate a zip file in cartridge memory space
|
// Locate a zip file in cartridge memory space
|
||||||
|
|
||||||
// consolePrintf("ZIP file check...");
|
// consolePrintf("ZIP file check...");
|
||||||
|
|
||||||
char* p = (char *) ZF_SEARCH_START;
|
char* p = (char *) ZF_SEARCH_START;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
_zipFile = NULL;
|
_zipFile = NULL;
|
||||||
|
|
||||||
while ((p != (char *) ZF_SEARCH_END) && (!found)) {
|
while ((p != (char *) ZF_SEARCH_END) && (!found)) {
|
||||||
// Zip file header is: 0x504B0304
|
// Zip file header is: 0x504B0304
|
||||||
|
|
||||||
if ( (*p == 0x50) && (*(p + 1) == 0x4B) && (*(p + 2) == 0x03) && (*(p + 3) == 0x04) ) {
|
if ( (*p == 0x50) && (*(p + 1) == 0x4B) && (*(p + 2) == 0x03) && (*(p + 3) == 0x04) ) {
|
||||||
// Found header!
|
// Found header!
|
||||||
found = true;
|
found = true;
|
||||||
_zipFile = p;
|
_zipFile = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) p += ZF_SEARCH_STRIDE;
|
if (!found) p += ZF_SEARCH_STRIDE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_zipFile) {
|
if (_zipFile) {
|
||||||
|
@ -56,14 +56,14 @@ ZipFile::ZipFile() {
|
||||||
// consolePrintf("Not in use!\n");
|
// consolePrintf("Not in use!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeToRoot();
|
changeToRoot();
|
||||||
restartFile();
|
restartFile();
|
||||||
|
|
||||||
if (_currentFile->compSize != (u32) getFileSize()) {
|
if (_currentFile->compSize != (u32) getFileSize()) {
|
||||||
consolePrintf("Error: ZIP file contains compression!\n");
|
consolePrintf("Error: ZIP file contains compression!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
_allFilesVisible = false;
|
_allFilesVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,73 +83,73 @@ bool ZipFile::restartFile() {
|
||||||
getFileName(name);
|
getFileName(name);
|
||||||
more = skipFile();
|
more = skipFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
return more;
|
return more;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZipFile::currentFileInFolder() {
|
bool ZipFile::currentFileInFolder() {
|
||||||
char name[128];
|
char name[128];
|
||||||
|
|
||||||
if (_allFilesVisible) return true;
|
if (_allFilesVisible) return true;
|
||||||
|
|
||||||
getFileName(name);
|
getFileName(name);
|
||||||
|
|
||||||
// consolePrintf("N:'%s'D:'%s'\n", name, _directory);
|
// consolePrintf("N:'%s'D:'%s'\n", name, _directory);
|
||||||
|
|
||||||
if (_directory[0] == 0) { // Root directory
|
if (_directory[0] == 0) { // Root directory
|
||||||
name[strlen(name) - 1] = 0;
|
name[strlen(name) - 1] = 0;
|
||||||
return !strchr(name, '\\'); // Not in root if contains a / character before the last character
|
return !strchr(name, '\\'); // Not in root if contains a / character before the last character
|
||||||
} else {
|
} else {
|
||||||
/* if (name starts with directory && it's not the directory
|
/* if (name starts with directory && it's not the directory
|
||||||
&& (no slashes after the directory || it's the last character)
|
&& (no slashes after the directory || it's the last character)
|
||||||
&& (slash follows directory)
|
&& (slash follows directory)
|
||||||
*/
|
*/
|
||||||
if ((strstr(name, _directory) == name) && (strlen(name) != strlen(_directory))
|
if ((strstr(name, _directory) == name) && (strlen(name) != strlen(_directory))
|
||||||
&& ((strchr(name + strlen(_directory) + 1, '\\') == NULL)
|
&& ((strchr(name + strlen(_directory) + 1, '\\') == NULL)
|
||||||
|| (strchr(name + strlen(_directory) + 1, '\\') == name + strlen(name) - 1))
|
|| (strchr(name + strlen(_directory) + 1, '\\') == name + strlen(name) - 1))
|
||||||
&& (*(name + strlen(_directory)) == '\\')) {
|
&& (*(name + strlen(_directory)) == '\\')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZipFile::getFileName(char* name) {
|
void ZipFile::getFileName(char* name) {
|
||||||
strncpy(name, (char *) (_currentFile + 1), _currentFile->nameLength);
|
strncpy(name, (char *) (_currentFile + 1), _currentFile->nameLength);
|
||||||
|
|
||||||
for (int r = 0; r < (int) strlen(name); r++) {
|
for (int r = 0; r < (int) strlen(name); r++) {
|
||||||
if (name[r] == '/') name[r] = '\\';
|
if (name[r] == '/') name[r] = '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
name[_currentFile->nameLength] = 0;
|
name[_currentFile->nameLength] = 0;
|
||||||
|
|
||||||
if (name[strlen(name) - 1] == '\\') {
|
if (name[strlen(name) - 1] == '\\') {
|
||||||
name[strlen(name) - 1] = 0;
|
name[strlen(name) - 1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZipFile::skipFile() {
|
bool ZipFile::skipFile() {
|
||||||
bool valid;
|
bool valid;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
// Move on to the next file
|
// Move on to the next file
|
||||||
_currentFile = (FileHeader *) (
|
_currentFile = (FileHeader *) (
|
||||||
((char *) (_currentFile)) + sizeof(*_currentFile) + _currentFile->nameLength + _currentFile->fileSize + _currentFile->extraLength
|
((char *) (_currentFile)) + sizeof(*_currentFile) + _currentFile->nameLength + _currentFile->fileSize + _currentFile->extraLength
|
||||||
);
|
);
|
||||||
|
|
||||||
// Return true if there are more files. Check this by looking for the magic number
|
// Return true if there are more files. Check this by looking for the magic number
|
||||||
valid = (_currentFile->magic[0] == 0x50) &&
|
valid = (_currentFile->magic[0] == 0x50) &&
|
||||||
(_currentFile->magic[1] == 0x4B) &&
|
(_currentFile->magic[1] == 0x4B) &&
|
||||||
(_currentFile->magic[2] == 0x03) &&
|
(_currentFile->magic[2] == 0x03) &&
|
||||||
(_currentFile->magic[3] == 0x04);
|
(_currentFile->magic[3] == 0x04);
|
||||||
|
|
||||||
|
|
||||||
} while (valid && !currentFileInFolder());
|
} while (valid && !currentFileInFolder());
|
||||||
|
|
||||||
return valid;
|
return valid;
|
||||||
|
|
||||||
// Currently doesn't handle data descriptors!
|
// Currently doesn't handle data descriptors!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ int ZipFile::getFileSize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZipFile::isDirectory() {
|
bool ZipFile::isDirectory() {
|
||||||
return _currentFile->fileSize == 0; // This is a bit wrong, but seems to work.
|
return _currentFile->fileSize == 0; // This is a bit wrong, but seems to work.
|
||||||
}
|
}
|
||||||
|
|
||||||
char* ZipFile::getFile() {
|
char* ZipFile::getFile() {
|
||||||
|
@ -180,7 +180,7 @@ char* ZipFile::getFile() {
|
||||||
bool ZipFile::findFile(char* search) {
|
bool ZipFile::findFile(char* search) {
|
||||||
changeToRoot();
|
changeToRoot();
|
||||||
restartFile();
|
restartFile();
|
||||||
|
|
||||||
char searchName[128];
|
char searchName[128];
|
||||||
strcpy(searchName, search);
|
strcpy(searchName, search);
|
||||||
for (int r = 0; r < (int) strlen(searchName); r++) {
|
for (int r = 0; r < (int) strlen(searchName); r++) {
|
||||||
|
@ -191,15 +191,15 @@ bool ZipFile::findFile(char* search) {
|
||||||
*(searchName + strlen(searchName) - 1) = '\0'; // which we need to dispose of.
|
*(searchName + strlen(searchName) - 1) = '\0'; // which we need to dispose of.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
char name[128];
|
char name[128];
|
||||||
getFileName(name);
|
getFileName(name);
|
||||||
if (*(name + strlen(name) - 1) == '\\') { // Directories have a terminating slash
|
if (*(name + strlen(name) - 1) == '\\') { // Directories have a terminating slash
|
||||||
*(name + strlen(name) - 1) = '\0'; // which we need to dispose of.
|
*(name + strlen(name) - 1) = '\0'; // which we need to dispose of.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!stricmp(name, searchName)) {
|
if (!stricmp(name, searchName)) {
|
||||||
// consolePrintf("'%s'=='%s'\n", name, searchName);
|
// consolePrintf("'%s'=='%s'\n", name, searchName);
|
||||||
return true; // Got it!
|
return true; // Got it!
|
||||||
|
@ -222,7 +222,7 @@ void ZipFile::changeDirectory(char* dir) {
|
||||||
for (int r = 0; r < (int) strlen(_directory); r++) {
|
for (int r = 0; r < (int) strlen(_directory); r++) {
|
||||||
if (_directory[r] == '/') _directory[r] = '\\';
|
if (_directory[r] == '/') _directory[r] = '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_directory[strlen(_directory) - 1] == '\\') {
|
if (_directory[strlen(_directory) - 1] == '\\') {
|
||||||
_directory[strlen(_directory) - 1] = '\0';
|
_directory[strlen(_directory) - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ZIPREADER_H_
|
#ifndef _ZIPREADER_H_
|
||||||
#define _ZIPREADER_H_
|
#define _ZIPREADER_H_
|
||||||
#include "portdefs.h"
|
#include "portdefs.h"
|
||||||
|
@ -45,9 +45,9 @@ class ZipFile {
|
||||||
|
|
||||||
char* _zipFile;
|
char* _zipFile;
|
||||||
char _directory[128];
|
char _directory[128];
|
||||||
|
|
||||||
bool _allFilesVisible;
|
bool _allFilesVisible;
|
||||||
|
|
||||||
FileHeader* _currentFile;
|
FileHeader* _currentFile;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -55,25 +55,25 @@ public:
|
||||||
~ZipFile();
|
~ZipFile();
|
||||||
|
|
||||||
bool isReady();
|
bool isReady();
|
||||||
|
|
||||||
// These operations set the current file
|
// These operations set the current file
|
||||||
bool restartFile();
|
bool restartFile();
|
||||||
bool skipFile();
|
bool skipFile();
|
||||||
bool findFile(char* search);
|
bool findFile(char* search);
|
||||||
|
|
||||||
// These return the file's data and information
|
// These return the file's data and information
|
||||||
char* getFile();
|
char* getFile();
|
||||||
int getFileSize();
|
int getFileSize();
|
||||||
void getFileName(char* name);
|
void getFileName(char* name);
|
||||||
bool isDirectory();
|
bool isDirectory();
|
||||||
|
|
||||||
// These set the current directory
|
// These set the current directory
|
||||||
void changeDirectory(char* name);
|
void changeDirectory(char* name);
|
||||||
void changeToRoot();
|
void changeToRoot();
|
||||||
void setAllFilesVisible(bool state) { _allFilesVisible = state; }
|
void setAllFilesVisible(bool state) { _allFilesVisible = state; }
|
||||||
|
|
||||||
bool currentFileInFolder();
|
bool currentFileInFolder();
|
||||||
|
|
||||||
u16 misaligned16(u16* v);
|
u16 misaligned16(u16* v);
|
||||||
u32 misaligned32(u32* v);
|
u32 misaligned32(u32* v);
|
||||||
|
|
||||||
|
|
|
@ -1,187 +0,0 @@
|
||||||
CC := arm-elf-gcc
|
|
||||||
CXX := arm-elf-g++
|
|
||||||
LD := arm-elf-g++
|
|
||||||
AS := arm-elf-as
|
|
||||||
AR := arm-elf-ar cru
|
|
||||||
RANLIB := arm-elf-ranlib
|
|
||||||
RM := rm -f
|
|
||||||
MKDIR := mkdir -p
|
|
||||||
ECHO := echo -n
|
|
||||||
CAT := cat
|
|
||||||
RM := rm -f
|
|
||||||
# recursive version of RM
|
|
||||||
RM_REC := $(RM) -r
|
|
||||||
ZIP := zip -q
|
|
||||||
CP := cp
|
|
||||||
OBJCOPY := arm-elf-objcopy
|
|
||||||
FXETOOL := b2fxec
|
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# Default compilation parameters. Normally don't edit these #
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
CFLAGS = -marm -march=armv4t -mtune=arm920 -mapcs \
|
|
||||||
-finline-functions \
|
|
||||||
-fshort-enums \
|
|
||||||
-mstructure-size-boundary=32 \
|
|
||||||
-mno-thumb-interwork \
|
|
||||||
-I$(GPSDK)/include \
|
|
||||||
-g \
|
|
||||||
-O2 \
|
|
||||||
-fomit-frame-pointer
|
|
||||||
# -ffast-math \
|
|
||||||
# -fshort-double
|
|
||||||
|
|
||||||
CPPFLAGS:= $(CFLAGS)
|
|
||||||
CXXFLAGS:= $(CFLAGS)
|
|
||||||
DEFINES :=
|
|
||||||
LDFLAGS :=
|
|
||||||
INCLUDES:= -I. -Icommon
|
|
||||||
LIBS :=
|
|
||||||
OBJS :=
|
|
||||||
|
|
||||||
# Turn on useful warnings
|
|
||||||
CXXFLAGS+= -Wall -pedantic -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion
|
|
||||||
CXXFLAGS+= -Wshadow -Wuninitialized -Wimplicit -Wundef
|
|
||||||
CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
|
|
||||||
CXXFLAGS+= -Wwrite-strings -fcheck-new -Wctor-dtor-privacy -Wnon-virtual-dtor
|
|
||||||
|
|
||||||
# Stripped Build? (Smaller ELF, Minimal debug symbol information).
|
|
||||||
# You MUST comment this out with a # if you wish to debug your code.
|
|
||||||
STRIP_DEBUG = -Wl,--strip-debug
|
|
||||||
|
|
||||||
# GPSDK (SDK, Includes and Startup Files) base dir
|
|
||||||
GPSDK = /usr/compat/gp32/share/sdk
|
|
||||||
|
|
||||||
LDSPECS = -specs=gp32_gpsdk.specs
|
|
||||||
|
|
||||||
LDFLAGS = $(STRIP_DEBUG) -Wl,-Map,$(MAPFILE) $(LDSPECS) -Wl,--no-warn-mismatch
|
|
||||||
|
|
||||||
LIBS += -L$(GPSDK)/lib \
|
|
||||||
-lgpmem -lgpos -lgpstdio -lgpstdlib -lgpsound -lgpgraphic -lgpfont \
|
|
||||||
-lm -lc -lgcc
|
|
||||||
|
|
||||||
INCLUDES += -Ibackends/platform/gp32 -Iengines -I$(GPSDK)/include
|
|
||||||
|
|
||||||
MODULES += backends/platform/gp32
|
|
||||||
|
|
||||||
# Outputs
|
|
||||||
EXEEXT = .elf
|
|
||||||
MAPFILE = scummvm.map
|
|
||||||
BIN = scummvm.gxb
|
|
||||||
FXE = scummvm.fxe
|
|
||||||
|
|
||||||
# Plugins hack
|
|
||||||
srcdir = ./
|
|
||||||
|
|
||||||
DEFINES = -D__GP32__
|
|
||||||
DEFINES += -DNONSTANDARD_PORT
|
|
||||||
|
|
||||||
# Disable new themes. GP32 has LOW memory!
|
|
||||||
DEFINES += -DDISABLE_FANCY_THEMES
|
|
||||||
|
|
||||||
# Support libtremor.
|
|
||||||
#DEFINES += -DUSE_VORBIS -DUSE_TREMOR -DGP32_SDK
|
|
||||||
#INCLUDES += -Ibackends/platform/gp32/gptremor
|
|
||||||
#LIBS += -Lbackends/platform/gp32/gptremor -lgptremor
|
|
||||||
|
|
||||||
# Support libmad.
|
|
||||||
#DEFINES += -DUSE_MAD
|
|
||||||
#INCLUDES += -Ibackends/platform/gp32/gpmad
|
|
||||||
#LIBS += -Lbackends/platform/gp32/gpmad -lgpmad
|
|
||||||
|
|
||||||
# Support libminilzo.
|
|
||||||
DEFINES += -DUSE_MINILZO
|
|
||||||
INCLUDES += -Ibackends/platform/gp32/minilzo
|
|
||||||
LIBS += -Lbackends/platform/gp32/minilzo -lminilzo
|
|
||||||
|
|
||||||
# Support for 8:3 save files names (The GP32 uses FAT12/16 (no vFAT) for the file system).
|
|
||||||
DEFINES += -DSHORT_SAVENAMES
|
|
||||||
|
|
||||||
# Support for the unsigned sound mixer.
|
|
||||||
DEFINES += -DOUTPUT_UNSIGNED_AUDIO
|
|
||||||
|
|
||||||
# Support for the GP32 (fmOPL derived) MIDI engine.
|
|
||||||
# - NOT fully implemented yet.
|
|
||||||
#DEFINES += -DUSE_GP32_FMOPL
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#GP32 Debug - Remove from Release builds
|
|
||||||
# This builds in the GP32 GDB USB Stub. Don't use it unless you know what your doing.
|
|
||||||
# You also need to remove ANY optemisation from the compiler flags.
|
|
||||||
#DEFINES += -DGP32_GDB
|
|
||||||
#OBJS += backends/platform/gp32/debug-gdbstub-usb.o
|
|
||||||
|
|
||||||
# Standard librarys and optimization modules
|
|
||||||
OBJS += backends/platform/gp32/startup.o \
|
|
||||||
backends/platform/gp32/memcpy.o \
|
|
||||||
backends/platform/gp32/gp_asmlib.o \
|
|
||||||
backends/platform/gp32/gp_clipped.o \
|
|
||||||
backends/platform/gp32/fontdata.o
|
|
||||||
|
|
||||||
# Custom GP32 std library
|
|
||||||
OBJS += backends/platform/gp32/gp32std.o \
|
|
||||||
backends/platform/gp32/gp32std_file.o \
|
|
||||||
backends/platform/gp32/gp32std_grap.o \
|
|
||||||
backends/platform/gp32/gp32std_input.o \
|
|
||||||
backends/platform/gp32/gp32std_memory.o \
|
|
||||||
backends/platform/gp32/gp32std_sound.o \
|
|
||||||
#backends/platform/gp32/dmaaudio_asm.o \
|
|
||||||
#backends/platform/gp32/dmaaudio.o \
|
|
||||||
|
|
||||||
#Main ScummVM for the GP32 Backend
|
|
||||||
OBJS += backends/platform/gp32/gp32_main.o \
|
|
||||||
backends/platform/gp32/gp32_launcher.o \
|
|
||||||
backends/platform/gp32/gp32_osys.o \
|
|
||||||
backends/fs/gp32/gp32-fs.o
|
|
||||||
|
|
||||||
$(FXE): $(BIN)
|
|
||||||
$(FXETOOL) -f -a "The ScummVM Team" -t "ScummVM for the GP32" -b backends/platform/gp32/scummvm.bmp $< $@
|
|
||||||
|
|
||||||
$(BIN): scummvm$(EXEEXT)
|
|
||||||
$(OBJCOPY) -O binary $< $@
|
|
||||||
|
|
||||||
# Uncomment this to use GCC 3.x specific dependency tracking (recommended)
|
|
||||||
HAVE_GCC3 = 1
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# Control which modules are built - uncomment any to disable module #
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
DISABLE_SCALERS = 1
|
|
||||||
DISABLE_HQ_SCALERS = 1
|
|
||||||
|
|
||||||
ENABLE_SCUMM = STATIC_PLUGIN
|
|
||||||
|
|
||||||
# We can play The Dig with GP32 -- without any movies/musics/voices. But who would do that?
|
|
||||||
#ENABLE_SCUMM_7_8 = 1
|
|
||||||
#ENABLE_HE = 1
|
|
||||||
|
|
||||||
ENABLE_AGOS = STATIC_PLUGIN
|
|
||||||
ENABLE_SKY = STATIC_PLUGIN
|
|
||||||
ENABLE_QUEEN = STATIC_PLUGIN
|
|
||||||
ENABLE_GOB = STATIC_PLUGIN
|
|
||||||
ENABLE_LURE = STATIC_PLUGIN
|
|
||||||
ENABLE_CINE = STATIC_PLUGIN
|
|
||||||
ENABLE_SAGA = STATIC_PLUGIN
|
|
||||||
ENABLE_KYRA = STATIC_PLUGIN
|
|
||||||
ENABLE_AGI = STATIC_PLUGIN
|
|
||||||
|
|
||||||
# The engines below are not supported on the GP32 port so there is
|
|
||||||
# no point compiling support into the binary.
|
|
||||||
#ENABLE_SWORD1 = STATIC_PLUGIN
|
|
||||||
#ENABLE_SWORD2 = STATIC_PLUGIN
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# Misc stuff - you should normally never have to edit this #
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
EXECUTABLE := scummvm$(EXEEXT)
|
|
||||||
|
|
||||||
include Makefile.common
|
|
||||||
|
|
||||||
dist:
|
|
||||||
$(RM) $(ZIPFILE)
|
|
||||||
$(ZIP) $(ZIPFILE) $(DISTFILES)
|
|
|
@ -1 +0,0 @@
|
||||||
TODO. :)
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,284 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const unsigned char fontresEng1[] =
|
|
||||||
{
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x81,0x7E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0xFF,0xDB,0xFF,0xFF,0xC3,0xFF,0x7E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x36,0x7F,0x7F,0x7F,0x7F,0x3E,0x1C,0x08,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x08,0x1C,0x3E,0x7F,0x3E,0x1C,0x08,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x3C,0x3C,0x7E,0x66,0x7E,0x18,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x3C,0x3C,0x7E,0x7E,0x3C,0x18,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0xFF,0xFF,0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0xFF,0xFF,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x0F,0x07,0x0D,0x19,0x3C,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x66,0x3C,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x33,0x3C,0x33,0x30,0x70,0xF0,0x70,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7F,0x63,0x7F,0x63,0x63,0x67,0xE7,0xE6,0xC0,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0xDB,0x3C,0xE7,0x3C,0xDB,0x18,0x18,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x40,0x60,0x70,0x7C,0x7F,0x7C,0x70,0x60,0x40,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x01,0x03,0x07,0x1F,0x7F,0x1F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x33,0x33,0x33,0x33,0x33,0x00,0x33,0x33,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7F,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x3E,0x63,0x30,0x1C,0x36,0x63,0x63,0x36,0x1C,0x06,0x63,0x3E,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x7E,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x0C,0x06,0x7F,0x06,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x7F,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xFF,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x08,0x1C,0x1C,0x3E,0x3E,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x7F,0x7F,0x3E,0x3E,0x1C,0x1C,0x08,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x36,0x36,0x7F,0x36,0x36,0x7F,0x36,0x36,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x18,0x18,0x3C,0x66,0x60,0x3C,0x06,0x06,0x66,0x3C,0x18,0x18,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x61,0x63,0x06,0x0C,0x18,0x30,0x63,0x43,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x1C,0x36,0x36,0x1C,0x3B,0x6E,0x66,0x3B,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x0C,0x06,0x06,0x06,0x06,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x01,0x03,0x06,0x0C,0x18,0x30,0x60,0x40,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x66,0x6E,0x76,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x66,0x06,0x0C,0x18,0x30,0x7E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x06,0x1C,0x06,0x06,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x0C,0x1C,0x3C,0x6C,0x6C,0x7E,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0x60,0x60,0x7C,0x06,0x06,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x60,0x60,0x7C,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0x06,0x06,0x0C,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x66,0x3C,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x3E,0x06,0x06,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x06,0x0C,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x66,0x6E,0x6E,0x6E,0x60,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x3C,0x66,0x66,0x7E,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7C,0x66,0x66,0x7C,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x60,0x60,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0x60,0x60,0x7C,0x60,0x60,0x60,0x7E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0x60,0x60,0x7C,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x6E,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x66,0x7E,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x6C,0x78,0x70,0x78,0x6C,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x7E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x63,0x77,0x7F,0x6B,0x6B,0x63,0x63,0x63,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x76,0x7E,0x6E,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x04,0x06,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7C,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x60,0x3C,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x6B,0x7F,0x77,0x63,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x3C,0x18,0x3C,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0x06,0x0C,0x18,0x30,0x60,0x60,0x7E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x40,0x60,0x30,0x18,0x0C,0x06,0x03,0x01,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,
|
|
||||||
0x00,0x00,0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x06,0x06,0x3E,0x66,0x66,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x7E,0x60,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3C,0x66,0x60,0x78,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x60,0x60,0x7C,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x06,0x00,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x60,0x60,0x66,0x6C,0x78,0x6C,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x77,0x7F,0x6B,0x6B,0x6B,0x6B,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x6C,0x7E,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x7C,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x3E,0x06,0x06,0x06,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x6E,0x78,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x38,0x0C,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x30,0x30,0x7C,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x6B,0x7F,0x36,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0x18,0x18,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x7E,0x0C,0x18,0x30,0x60,0x7E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x08,0x1C,0x36,0x63,0x63,0x7F,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x3C,0x66,0xC2,0xC0,0xC2,0x66,0x3C,0x18,0x0E,0x0C,0x78,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x66,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x06,0x0C,0x18,0x00,0x3E,0x63,0x7F,0x60,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x08,0x1C,0x36,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x30,0x18,0x0C,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x1C,0x36,0x1C,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x08,0x1C,0x36,0x00,0x3E,0x63,0x7F,0x60,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x00,0x3E,0x63,0x7F,0x60,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x30,0x18,0x0C,0x00,0x3E,0x63,0x7F,0x60,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x66,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x63,0x63,0x08,0x1C,0x36,0x63,0x63,0x7F,0x63,0x63,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x1C,0x36,0x1C,0x00,0x1C,0x36,0x63,0x63,0x7F,0x63,0x63,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x0C,0x18,0x30,0x00,0x7F,0x33,0x30,0x3E,0x30,0x33,0x7F,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x6E,0x3B,0x1B,0x7E,0xD8,0xDC,0x77,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x1F,0x36,0x66,0x66,0x7F,0x66,0x66,0x66,0x67,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x08,0x1C,0x36,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x63,0x63,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x30,0x18,0x0C,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x18,0x3C,0x66,0x00,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x30,0x18,0x0C,0x00,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x63,0x63,0x00,0x63,0x63,0x63,0x63,0x3F,0x03,0x06,0x3C,0x00,0x00,
|
|
||||||
0x00,0x00,0x63,0x63,0x1C,0x36,0x63,0x63,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x63,0x63,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x18,0x18,0x7E,0xC3,0xC0,0xC0,0xC3,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x1C,0x36,0x32,0x30,0x78,0x30,0x30,0x30,0x73,0x7E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0xC3,0x66,0x3C,0x18,0xFF,0x18,0xFF,0x18,0x18,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0xFC,0x66,0x66,0x7C,0x62,0x66,0x6F,0x66,0x66,0xF3,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x0E,0x1B,0x18,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0xD8,0x70,0x00,0x00,
|
|
||||||
0x00,0x00,0x0C,0x18,0x30,0x00,0x3C,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x0C,0x18,0x30,0x00,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x0C,0x18,0x30,0x00,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x3B,0x6E,0x00,0x6E,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x3B,0x6E,0x00,0x63,0x73,0x7B,0x7F,0x6F,0x67,0x63,0x63,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x30,0x63,0x63,0x3E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x60,0x60,0x60,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x60,0xE0,0x63,0x66,0x6C,0x18,0x30,0x6E,0xC3,0x06,0x0C,0x1F,0x00,0x00,
|
|
||||||
0x00,0x00,0x60,0xE0,0x63,0x66,0x6C,0x18,0x33,0x67,0xCF,0x1F,0x03,0x03,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x1B,0x36,0x6C,0x36,0x1B,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x6C,0x36,0x1B,0x36,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,
|
|
||||||
0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,
|
|
||||||
0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
|
||||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
|
||||||
0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,
|
|
||||||
0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,
|
|
||||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x6E,0x6C,0x6C,0x6E,0x3B,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x7E,0x63,0x63,0x7E,0x60,0x60,0x20,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7F,0x63,0x63,0x60,0x60,0x60,0x60,0x60,0x60,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x7F,0x36,0x36,0x36,0x36,0x36,0x36,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7F,0x63,0x30,0x18,0x0C,0x18,0x30,0x63,0x7F,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x6C,0x6C,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x33,0x33,0x33,0x33,0x3E,0x30,0x30,0x60,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3F,0x6C,0x0C,0x0C,0x0C,0x0C,0x0C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x7E,0x18,0x3C,0x66,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x1C,0x36,0x63,0x63,0x7F,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x1C,0x36,0x63,0x63,0x63,0x36,0x36,0x36,0x77,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x1E,0x30,0x18,0x0C,0x3E,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x03,0x06,0x7E,0xDB,0xDB,0xF3,0x7E,0x60,0xC0,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x1C,0x30,0x60,0x60,0x7C,0x60,0x60,0x30,0x1C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x7F,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0xFF,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,
|
|
||||||
0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3B,0x6E,0x00,0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0xEC,0x6C,0x3C,0x1C,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0xD8,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x3E,0x3E,0x3E,0x3E,0x3E,0x3E,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
};
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,44 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GLOBALS_H
|
|
||||||
#define __GLOBALS_H
|
|
||||||
|
|
||||||
enum {
|
|
||||||
FM_QUALITY_LOW = 0,
|
|
||||||
FM_QUALITY_MED,
|
|
||||||
FM_QUALITY_HI
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GlobalVars {
|
|
||||||
uint16 cpuSpeed;
|
|
||||||
uint16 gammaRamp;
|
|
||||||
uint8 fmQuality;
|
|
||||||
uint32 sampleRate;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern GlobalVars g_vars;
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,190 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
#include "common/file.h"
|
|
||||||
|
|
||||||
#include "engines/engine.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_grap.h"
|
|
||||||
#include "gp32std_input.h"
|
|
||||||
#include "gp32_launcher.h"
|
|
||||||
|
|
||||||
#include "gfx_splash.h"
|
|
||||||
#include "globals.h"
|
|
||||||
|
|
||||||
uint16 cpuSpeedTable[15] = {40, 66, 100, 120, 133, 144, 156, 160, 166, 172, 176, 180, 188, 192, 200};
|
|
||||||
uint16 gammaTable[16] = {5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000};
|
|
||||||
char *oplTable[3] = {"LOW", "MEDIUM", "HIGH"};
|
|
||||||
uint16 sampleTable[4] = {0, 11025, 22050, 44100};
|
|
||||||
|
|
||||||
uint8 maxTable[5] = {15, 16, 3, 3, 2};
|
|
||||||
uint8 currentSetting[5] = {2, 5, 1, 1, 0};
|
|
||||||
|
|
||||||
void writeConfigVars() {
|
|
||||||
Common::File file;
|
|
||||||
|
|
||||||
g_vars.cpuSpeed = cpuSpeedTable[currentSetting[0]];
|
|
||||||
g_vars.gammaRamp = gammaTable[currentSetting[1]];
|
|
||||||
g_vars.fmQuality = currentSetting[2];
|
|
||||||
g_vars.sampleRate = sampleTable[currentSetting[3]];
|
|
||||||
|
|
||||||
if (!file.open("gp:\\gpetc\\scummvm.cfg", Common::File::kFileWriteMode)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
file.writeByte(currentSetting[0]);
|
|
||||||
file.writeByte(currentSetting[1]);
|
|
||||||
file.writeByte(currentSetting[2]);
|
|
||||||
file.writeByte(currentSetting[3]);
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void readConfigVars() {
|
|
||||||
Common::File file;
|
|
||||||
if (!file.open("gp:\\gpetc\\scummvm.cfg", Common::File::kFileReadMode)) {
|
|
||||||
currentSetting[0] = 2;
|
|
||||||
currentSetting[1] = 5;
|
|
||||||
currentSetting[2] = 1;
|
|
||||||
currentSetting[3] = 1;
|
|
||||||
writeConfigVars();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
currentSetting[0] = file.readByte();
|
|
||||||
currentSetting[1] = file.readByte();
|
|
||||||
currentSetting[2] = file.readByte();
|
|
||||||
currentSetting[3] = file.readByte();
|
|
||||||
g_vars.cpuSpeed = cpuSpeedTable[currentSetting[0]];
|
|
||||||
g_vars.gammaRamp = gammaTable[currentSetting[1]];
|
|
||||||
g_vars.fmQuality = currentSetting[2];
|
|
||||||
g_vars.sampleRate = sampleTable[currentSetting[3]];
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void configMenu() {
|
|
||||||
uint32 nKeyUD;
|
|
||||||
uint16 nKeyP;
|
|
||||||
|
|
||||||
int currentSelect = 0;
|
|
||||||
char text[32];
|
|
||||||
|
|
||||||
// OK / CANCEL
|
|
||||||
currentSetting[4] = 0;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
gp_fillRect(frameBuffer2, 0, 0, 320, 240, 0xffff);
|
|
||||||
gp_textOut(frameBuffer2, 90, 10, "Configuration Menu", 0);
|
|
||||||
|
|
||||||
gp_textOut(frameBuffer2, 30, 40, "CPU clock speed", 0);
|
|
||||||
gp_textOut(frameBuffer2, 30, 80, "Gamma ramp", 0);
|
|
||||||
gp_textOut(frameBuffer2, 30, 120, "FMOPL (AdLib) quality", 0);
|
|
||||||
gp_textOut(frameBuffer2, 30, 160, "Sampling rate", 0);
|
|
||||||
|
|
||||||
gp_textOut(frameBuffer2, 100, 210, "OK CANCEL", 0);
|
|
||||||
|
|
||||||
if (currentSelect == 4) {
|
|
||||||
gp_textOut(frameBuffer2, 80 + currentSetting[4] * 100, 210, "@", 0);
|
|
||||||
} else
|
|
||||||
gp_textOut(frameBuffer2, 20, (currentSelect + 1) * 40, "@", 0);
|
|
||||||
|
|
||||||
sprintf(text, "%d MHz", cpuSpeedTable[currentSetting[0]]);
|
|
||||||
gp_textOut(frameBuffer2, 220, 40, text, 0);
|
|
||||||
sprintf(text, "%.2f", (float)gammaTable[currentSetting[1]] / 10000);
|
|
||||||
gp_textOut(frameBuffer2, 220, 80, text, 0);
|
|
||||||
gp_textOut(frameBuffer2, 220, 120, oplTable[currentSetting[2]], 0);
|
|
||||||
if (sampleTable[currentSetting[3]] == 0) {
|
|
||||||
strcpy(text, "NO SOUND");
|
|
||||||
} else {
|
|
||||||
sprintf(text, "%d Hz", sampleTable[currentSetting[3]]);
|
|
||||||
}
|
|
||||||
gp_textOut(frameBuffer2, 220, 160, text, 0);
|
|
||||||
|
|
||||||
gp_flipScreen();
|
|
||||||
|
|
||||||
gp_getButtonEvent(&nKeyUD, &nKeyP);
|
|
||||||
|
|
||||||
if (gpd_getButtonDown(nKeyUD, GPC_VK_UP)) {
|
|
||||||
if (currentSelect > 0)
|
|
||||||
currentSelect--;
|
|
||||||
}
|
|
||||||
if (gpd_getButtonDown(nKeyUD, GPC_VK_DOWN)) {
|
|
||||||
if (currentSelect < 4)
|
|
||||||
currentSelect++;
|
|
||||||
}
|
|
||||||
if (gpd_getButtonDown(nKeyUD, GPC_VK_LEFT)) {
|
|
||||||
if (currentSelect <= 4)
|
|
||||||
if (currentSetting[currentSelect] > 0)
|
|
||||||
currentSetting[currentSelect]--;
|
|
||||||
}
|
|
||||||
if (gpd_getButtonDown(nKeyUD, GPC_VK_RIGHT)) {
|
|
||||||
if (currentSelect <= 4)
|
|
||||||
if (currentSetting[currentSelect] < maxTable[currentSelect] - 1)
|
|
||||||
currentSetting[currentSelect]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gpd_getButtonUp(nKeyUD, GPC_VK_START) ||
|
|
||||||
gpd_getButtonUp(nKeyUD, GPC_VK_FA)) {
|
|
||||||
if (currentSelect == 4) {
|
|
||||||
if (currentSetting[currentSelect] == 0) { // OK
|
|
||||||
writeConfigVars();
|
|
||||||
return;
|
|
||||||
} else { // CANCEL
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void splashScreen() {
|
|
||||||
uint32 nKeyUD;
|
|
||||||
uint16 nKeyP;
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
uint16 *buffer = frameBuffer2;//&frameBuffer1[240 - _screenHeight];
|
|
||||||
uint8 *picBuffer = gfx_splash;
|
|
||||||
|
|
||||||
for (int c = 0; c < LCD_WIDTH * LCD_HEIGHT; c++) {
|
|
||||||
*buffer++ = gfx_splash_Pal[*picBuffer++];
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_flipScreen();
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
gp_getButtonEvent(&nKeyUD, &nKeyP);
|
|
||||||
|
|
||||||
if (gpd_getButtonUp(nKeyUD, GPC_VK_START) ||
|
|
||||||
gpd_getButtonUp(nKeyUD, GPC_VK_FA)) {
|
|
||||||
gp_fillRect(frameBuffer1, 0, 0, 320, 240, 0xffff);
|
|
||||||
gp_fillRect(frameBuffer2, 0, 0, 320, 240, 0xffff);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (gpd_getButtonUp(nKeyUD, GPC_VK_SELECT)) {
|
|
||||||
configMenu();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GP32_LAUNCHER_H
|
|
||||||
#define __GP32_LAUNCHER_H
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
|
|
||||||
extern void readConfigVars();
|
|
||||||
|
|
||||||
extern void splashScreen();
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,93 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
|
|
||||||
#include "common/config-manager.h"
|
|
||||||
|
|
||||||
#include "base/main.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_grap.h"
|
|
||||||
|
|
||||||
#include "gp32_launcher.h"
|
|
||||||
#include "gp32_osys.h"
|
|
||||||
#include "globals.h"
|
|
||||||
|
|
||||||
GlobalVars g_vars;
|
|
||||||
|
|
||||||
void init() {
|
|
||||||
gp_setCpuSpeed(40); // Default CPU Speed
|
|
||||||
|
|
||||||
GpGraphicModeSet(16, NULL);
|
|
||||||
|
|
||||||
//if (type == NLU || type == FLU || type == BLU)
|
|
||||||
// gp_initFramebuffer(frameBuffer, 16, 85);
|
|
||||||
//else if (type == BLUPLUS)
|
|
||||||
// gp_initFramebufferBP(frameBuffer, 16, 85);
|
|
||||||
// else
|
|
||||||
// error("Invalid Console");
|
|
||||||
gp_initFrameBuffer();
|
|
||||||
|
|
||||||
GpFatInit();
|
|
||||||
GpRelativePathSet("gp:\\gpmm");
|
|
||||||
}
|
|
||||||
|
|
||||||
void GpMain(void *arg) {
|
|
||||||
extern void memBlockInit();
|
|
||||||
memBlockInit();
|
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
||||||
readConfigVars();
|
|
||||||
|
|
||||||
splashScreen();
|
|
||||||
|
|
||||||
//doConfig
|
|
||||||
gp_initGammaTable((float)g_vars.gammaRamp / 10000);
|
|
||||||
gp_setCpuSpeed(g_vars.cpuSpeed);
|
|
||||||
GPDEBUG("Set CPU Speed: %d", g_vars.cpuSpeed);
|
|
||||||
|
|
||||||
// FOR DEBUG PURPOSE!
|
|
||||||
//int argc = 4;
|
|
||||||
//char *argv[] = { "scummvm", "-enull", "-pgp:\\game\\dott\\", "tentacle" };
|
|
||||||
//int argc = 2;
|
|
||||||
//char *argv[] = { "scummvm", "-d5" };
|
|
||||||
|
|
||||||
extern OSystem *OSystem_GP32_create();
|
|
||||||
g_system = OSystem_GP32_create();
|
|
||||||
assert(g_system);
|
|
||||||
|
|
||||||
// Invoke the actual ScummVM main entry point:
|
|
||||||
//int res = scummvm_main(argc, argv);
|
|
||||||
int res = scummvm_main(1, NULL);
|
|
||||||
|
|
||||||
extern void memBlockDeinit();
|
|
||||||
memBlockDeinit();
|
|
||||||
|
|
||||||
g_system->quit(); // TODO: Consider removing / replacing this!
|
|
||||||
|
|
||||||
//return res;
|
|
||||||
}
|
|
|
@ -1,792 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
#include "common/system.h"
|
|
||||||
|
|
||||||
#include "common/rect.h"
|
|
||||||
#include "common/savefile.h"
|
|
||||||
#include "common/config-manager.h"
|
|
||||||
#include "graphics/surface.h"
|
|
||||||
|
|
||||||
#include "gp32_osys.h"
|
|
||||||
#include "globals.h"
|
|
||||||
|
|
||||||
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
|
|
||||||
{0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
OSystem_GP32::OSystem_GP32() :
|
|
||||||
_screenWidth(0), _screenHeight(0), _gameScreen(NULL), _hwScreen(NULL),
|
|
||||||
_overlayVisible(false), _forceFull(false), _adjustAspectRatio(false),
|
|
||||||
/*_paletteDirtyStart(0), _paletteDirtyEnd(0),*/
|
|
||||||
_mouseBuf(NULL), _mouseHeight(0), _mouseWidth(0), _mouseKeyColor(0),
|
|
||||||
_mouseHotspotX(0), _mouseHotspotY(0) {
|
|
||||||
NP("OSys::OSystem_GP32()");
|
|
||||||
// allocate palette storage
|
|
||||||
memset(_currentPalette, 0, 256 * sizeof(uint16));
|
|
||||||
|
|
||||||
memset(&_km, 0, sizeof(_km));
|
|
||||||
|
|
||||||
// HACK: bring mouse cursor to center
|
|
||||||
_mouseX = 160;
|
|
||||||
_mouseY = 120;
|
|
||||||
}
|
|
||||||
|
|
||||||
OSystem_GP32::~OSystem_GP32() {
|
|
||||||
NP("OSys::~OSystem_GP32()");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem_GP32::hasFeature(Feature f) {
|
|
||||||
NP("OSys::hasFeature()");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::setFeatureState(Feature f, bool enable) {
|
|
||||||
NP("OSys::setFeatureState()");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem_GP32::getFeatureState(Feature f) {
|
|
||||||
NP("OSys::getFeatureState()");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const OSystem::GraphicsMode* OSystem_GP32::getSupportedGraphicsModes() const {
|
|
||||||
NP("OSys::getSupportedGraphicsModes()");
|
|
||||||
return s_supportedGraphicsModes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int OSystem_GP32::getDefaultGraphicsMode() const {
|
|
||||||
NP("OSys::getSupportedGraphicsModes()");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem_GP32::setGraphicsMode(int mode) {
|
|
||||||
NP("OSys::setGraphicsMode()");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem_GP32::setGraphicsMode(const char *name) {
|
|
||||||
NP("OSys::setGraphicsMode()");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int OSystem_GP32::getGraphicsMode() const {
|
|
||||||
NP("OSys::getGraphicsMode()");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::initSize(uint width, uint height) {
|
|
||||||
NP("OSys::initSize()");
|
|
||||||
|
|
||||||
if (width == _screenWidth && height == _screenHeight)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_screenWidth = width;
|
|
||||||
_screenHeight = height;
|
|
||||||
|
|
||||||
if (height != 200)
|
|
||||||
_adjustAspectRatio = false;
|
|
||||||
|
|
||||||
_overlayWidth = width;
|
|
||||||
_overlayHeight = height;
|
|
||||||
// _overlayWidth = 320;
|
|
||||||
// _overlayHeight = 240;
|
|
||||||
|
|
||||||
// Create the surface that contains the 8 bit game data
|
|
||||||
_gameScreen = new uint8[_screenWidth * _screenHeight];
|
|
||||||
|
|
||||||
// Create the surface that contains the scaled graphics in 16 bit mode
|
|
||||||
_tmpScreen = frameBuffer2;
|
|
||||||
|
|
||||||
// Create the surface that is connected with hardware screen
|
|
||||||
_hwScreen = frameBuffer1;
|
|
||||||
|
|
||||||
_overlayBuffer = new OverlayColor[_overlayWidth * _overlayHeight];
|
|
||||||
|
|
||||||
_km.x_max = _screenWidth - 1;
|
|
||||||
_km.y_max = _screenHeight - 1;
|
|
||||||
_km.x = _mouseX;
|
|
||||||
_km.y = _mouseY;
|
|
||||||
_km.delay_time = 25;
|
|
||||||
_km.last_time = 0;
|
|
||||||
|
|
||||||
// Clear Screen
|
|
||||||
gp_fillRect(_hwScreen, 0, 0, 320, 240, 0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
int16 OSystem_GP32::getHeight() {
|
|
||||||
//NP("OSys::getHeight()");
|
|
||||||
return _screenHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16 OSystem_GP32::getWidth() {
|
|
||||||
//NP("OSys::getWidth()");
|
|
||||||
return _screenWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::setPalette(const byte *colors, uint start, uint num) {
|
|
||||||
//NP("OSys::setPalette()");
|
|
||||||
const byte *b = colors;
|
|
||||||
uint i;
|
|
||||||
uint16 *base = _currentPalette + start;
|
|
||||||
for (i = 0; i < num; i++) {
|
|
||||||
base[i] = gp_RGBTo16(b[0], b[1], b[2]);
|
|
||||||
b += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (start < _paletteDirtyStart)
|
|
||||||
// _paletteDirtyStart = start;
|
|
||||||
|
|
||||||
// if (start + num > _paletteDirtyEnd)
|
|
||||||
// _paletteDirtyEnd = start + num;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::grabPalette(byte *colors, uint start, uint num) {
|
|
||||||
NP("OSys::grabPalette()");
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h) {
|
|
||||||
//NP("OSys::copyRectToScreen()");
|
|
||||||
//Clip the coordinates
|
|
||||||
if (x < 0) {
|
|
||||||
w += x;
|
|
||||||
src -= x;
|
|
||||||
x = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y < 0) {
|
|
||||||
h += y;
|
|
||||||
src -= y * pitch;
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (w > _screenWidth - x) {
|
|
||||||
w = _screenWidth - x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h > _screenHeight - y) {
|
|
||||||
h = _screenHeight - y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (w <= 0 || h <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
byte *dst = _gameScreen + y * _screenWidth + x;
|
|
||||||
|
|
||||||
if (_screenWidth == pitch && pitch == w) {
|
|
||||||
memcpy(dst, src, h * w);
|
|
||||||
} else {
|
|
||||||
do {
|
|
||||||
memcpy(dst, src, w);
|
|
||||||
src += pitch;
|
|
||||||
dst += _screenWidth;
|
|
||||||
} while (--h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Graphics::Surface *OSystem_GP32::lockScreen() {
|
|
||||||
_framebuffer.pixels = _gameScreen;
|
|
||||||
_framebuffer.w = _screenWidth;
|
|
||||||
_framebuffer.h = _screenHeight;
|
|
||||||
_framebuffer.pitch = _screenWidth;
|
|
||||||
_framebuffer.bytesPerPixel = 1;
|
|
||||||
|
|
||||||
return &_framebuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::unlockScreen() {
|
|
||||||
// The screen is always completely update anyway, so we don't have to force a full update here.
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Implement Dirty rect?
|
|
||||||
void OSystem_GP32::updateScreen() {
|
|
||||||
uint16 *buffer;
|
|
||||||
//TODO: adjust shakePos
|
|
||||||
|
|
||||||
// draw gamescreen
|
|
||||||
buffer = &_tmpScreen[240 - _screenHeight];
|
|
||||||
for (int x = 0; x < _screenWidth; x++) {
|
|
||||||
for (int y = 0; y < _screenHeight; y++) {
|
|
||||||
*buffer++ = _currentPalette[_gameScreen[((_screenHeight - 1) - y) * _screenWidth + x]];
|
|
||||||
}
|
|
||||||
buffer += 240 - _screenHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw overlay
|
|
||||||
if (_overlayVisible) {
|
|
||||||
buffer = &_tmpScreen[240 - _overlayHeight];
|
|
||||||
for (int x = 0; x < _overlayWidth; x++) {
|
|
||||||
for (int y = 0; y < _overlayHeight; y++) {
|
|
||||||
*buffer++ = _overlayBuffer[((_overlayHeight - 1) - y) * _overlayWidth + x];
|
|
||||||
}
|
|
||||||
buffer += 240 - _overlayHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw mouse
|
|
||||||
//adjust cursor position
|
|
||||||
int mX = _mouseX - _mouseHotspotX;
|
|
||||||
int mY = _mouseY - _mouseHotspotY;
|
|
||||||
//if (_overlayVisible)
|
|
||||||
//else
|
|
||||||
if (_mouseVisible)
|
|
||||||
for (int y = 0; y < _mouseHeight; y++) {
|
|
||||||
for (int x = 0; x < _mouseWidth; x++) {
|
|
||||||
if (mX + x < _screenWidth && mY + y < _screenHeight && mX + x >= 0 && mY + y >= 0)
|
|
||||||
if (_mouseBuf[y * _mouseWidth + x] != _mouseKeyColor)
|
|
||||||
gpd_drawPixel16(_tmpScreen, mX + x, mY + y, _currentPalette[_mouseBuf[y * _mouseWidth + x]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: draw softkeyboard
|
|
||||||
//gp_flipScreen();
|
|
||||||
//_hwScreen = frameBuffer1;
|
|
||||||
//_tmpScreen = frameBuffer2;
|
|
||||||
memcpy(_hwScreen, _tmpScreen, LCD_WIDTH * LCD_HEIGHT * sizeof(uint16));
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::setShakePos(int shakeOffset) {
|
|
||||||
//NP("OSys::setShakePos()");
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::showOverlay() {
|
|
||||||
//NP("OSys::showOverlay()");
|
|
||||||
_overlayVisible = true;
|
|
||||||
clearOverlay();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::hideOverlay() {
|
|
||||||
//NP("OSys::hideOverlay()");
|
|
||||||
_overlayVisible = false;
|
|
||||||
clearOverlay();
|
|
||||||
_forceFull = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear overlay with game screen
|
|
||||||
//TODO: Optimize?
|
|
||||||
void OSystem_GP32::clearOverlay() {
|
|
||||||
//NP("OSys::clearOverlay()");
|
|
||||||
if (!_overlayVisible)
|
|
||||||
return;
|
|
||||||
|
|
||||||
uint8 *s = _gameScreen;
|
|
||||||
OverlayColor *d = _overlayBuffer;
|
|
||||||
uint8 c;
|
|
||||||
for (int y = 0; y < _overlayHeight; y++) {
|
|
||||||
for (int x = 0; x < _overlayWidth; x++) {
|
|
||||||
c = *s;
|
|
||||||
*d++ = _currentPalette[c];
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_forceFull = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::grabOverlay(OverlayColor *buf, int pitch) {
|
|
||||||
//NP("OSys::grabOverlay()");
|
|
||||||
int h = _overlayHeight;
|
|
||||||
OverlayColor *src = _overlayBuffer;
|
|
||||||
|
|
||||||
do {
|
|
||||||
memcpy(buf, src, _overlayWidth * sizeof(OverlayColor));
|
|
||||||
src += _overlayWidth;
|
|
||||||
buf += pitch;
|
|
||||||
} while (--h);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
|
|
||||||
//NP("OSys::copyRectToOverlay()");
|
|
||||||
|
|
||||||
//Clip the coordinates
|
|
||||||
if (x < 0) {
|
|
||||||
w += x;
|
|
||||||
buf -= x;
|
|
||||||
x = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y < 0) {
|
|
||||||
h += y;
|
|
||||||
buf -= y * pitch;
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (w > _overlayWidth - x) {
|
|
||||||
w = _overlayWidth - x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h > _overlayHeight - y) {
|
|
||||||
h = _overlayHeight - y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (w <= 0 || h <= 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
OverlayColor *dst = _overlayBuffer + y * _overlayWidth + x;
|
|
||||||
if (_overlayWidth == pitch && pitch == w) {
|
|
||||||
memcpy(dst, buf, h * w * sizeof(OverlayColor));
|
|
||||||
} else {
|
|
||||||
do {
|
|
||||||
memcpy(dst, buf, w * sizeof(OverlayColor));
|
|
||||||
buf += pitch;
|
|
||||||
dst += _overlayWidth;
|
|
||||||
} while (--h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int16 OSystem_GP32::getOverlayHeight() {
|
|
||||||
return getHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
int16 OSystem_GP32::getOverlayWidth() {
|
|
||||||
return getWidth();
|
|
||||||
}
|
|
||||||
|
|
||||||
OverlayColor OSystem_GP32::RGBToColor(uint8 r, uint8 g, uint8 b) {
|
|
||||||
return gp_RGBTo16(r, g, b);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) {
|
|
||||||
gp_16ToRGB(color, &r, &g, &b);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem_GP32::showMouse(bool visible) {
|
|
||||||
NP("OSys::showMouse()");
|
|
||||||
if (_mouseVisible == visible)
|
|
||||||
return visible;
|
|
||||||
|
|
||||||
bool last = _mouseVisible;
|
|
||||||
_mouseVisible = visible;
|
|
||||||
|
|
||||||
updateScreen();
|
|
||||||
|
|
||||||
return last;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::warpMouse(int x, int y) {
|
|
||||||
//NP("OSys::warpMouse()");
|
|
||||||
//assert(x > 0 && x < _screenWidth);
|
|
||||||
//assert(y > 0 && y < _screenHeight);
|
|
||||||
_mouseX = x;
|
|
||||||
_mouseY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale) {
|
|
||||||
//NP("OSys::setMouseCursor()");
|
|
||||||
_mouseWidth = w;
|
|
||||||
_mouseHeight = h;
|
|
||||||
|
|
||||||
_mouseHotspotX = hotspotX;
|
|
||||||
_mouseHotspotY = hotspotY;
|
|
||||||
|
|
||||||
_mouseKeyColor = keycolor;
|
|
||||||
|
|
||||||
if (_mouseBuf)
|
|
||||||
free(_mouseBuf);
|
|
||||||
|
|
||||||
_mouseBuf = (byte *)malloc(w * h);
|
|
||||||
memcpy(_mouseBuf, buf, w * h);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::handleKbdMouse() {
|
|
||||||
uint32 curTime = getMillis();
|
|
||||||
if (curTime >= _km.last_time + _km.delay_time) {
|
|
||||||
_km.last_time = curTime;
|
|
||||||
if (_km.x_down_count == 1) {
|
|
||||||
_km.x_down_time = curTime;
|
|
||||||
_km.x_down_count = 2;
|
|
||||||
}
|
|
||||||
if (_km.y_down_count == 1) {
|
|
||||||
_km.y_down_time = curTime;
|
|
||||||
_km.y_down_count = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_km.x_vel || _km.y_vel) {
|
|
||||||
if (_km.x_down_count) {
|
|
||||||
if (curTime > _km.x_down_time + _km.delay_time * 12) {
|
|
||||||
if (_km.x_vel > 0)
|
|
||||||
_km.x_vel++;
|
|
||||||
else
|
|
||||||
_km.x_vel--;
|
|
||||||
} else if (curTime > _km.x_down_time + _km.delay_time * 8) {
|
|
||||||
if (_km.x_vel > 0)
|
|
||||||
_km.x_vel = 5;
|
|
||||||
else
|
|
||||||
_km.x_vel = -5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_km.y_down_count) {
|
|
||||||
if (curTime > _km.y_down_time + _km.delay_time * 12) {
|
|
||||||
if (_km.y_vel > 0)
|
|
||||||
_km.y_vel++;
|
|
||||||
else
|
|
||||||
_km.y_vel--;
|
|
||||||
} else if (curTime > _km.y_down_time + _km.delay_time * 8) {
|
|
||||||
if (_km.y_vel > 0)
|
|
||||||
_km.y_vel = 5;
|
|
||||||
else
|
|
||||||
_km.y_vel = -5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//GPDEBUG("%d %d - %d %d", _km.x, _km.y, _km.x_vel, _km.y_vel);
|
|
||||||
_km.x += _km.x_vel;
|
|
||||||
_km.y += _km.y_vel;
|
|
||||||
|
|
||||||
if (_km.x < 0) {
|
|
||||||
_km.x = 0;
|
|
||||||
_km.x_vel = -1;
|
|
||||||
_km.x_down_count = 1;
|
|
||||||
} else if (_km.x > _km.x_max) {
|
|
||||||
_km.x = _km.x_max;
|
|
||||||
_km.x_vel = 1;
|
|
||||||
_km.x_down_count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_km.y < 0) {
|
|
||||||
_km.y = 0;
|
|
||||||
_km.y_vel = -1;
|
|
||||||
_km.y_down_count = 1;
|
|
||||||
} else if (_km.y > _km.y_max) {
|
|
||||||
_km.y = _km.y_max;
|
|
||||||
_km.y_vel = 1;
|
|
||||||
_km.y_down_count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
warpMouse(_km.x, _km.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::fillMouseEvent(Common::Event &event, int x, int y) {
|
|
||||||
event.mouse.x = x;
|
|
||||||
event.mouse.y = y;
|
|
||||||
|
|
||||||
// Update the "keyboard mouse" coords
|
|
||||||
_km.x = x;
|
|
||||||
_km.y = y;
|
|
||||||
|
|
||||||
// Optionally perform aspect ratio adjusting
|
|
||||||
//if (_adjustAspectRatio)
|
|
||||||
// event.mouse.y = aspect2Real(event.mouse.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem_GP32::pollEvent(Common::Event &event) {
|
|
||||||
//NP("OSys::pollEvent()");
|
|
||||||
GP32BtnEvent ev;
|
|
||||||
|
|
||||||
handleKbdMouse();
|
|
||||||
|
|
||||||
if (!gp_pollButtonEvent(&ev))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
switch(ev.type) {
|
|
||||||
case BUTTON_DOWN:
|
|
||||||
if (ev.button == GPC_VK_LEFT) {
|
|
||||||
_km.x_vel = -1;
|
|
||||||
_km.x_down_count = 1;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_RIGHT) {
|
|
||||||
_km.x_vel = 1;
|
|
||||||
_km.x_down_count = 1;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_UP) {
|
|
||||||
_km.y_vel = -1;
|
|
||||||
_km.y_down_count = 1;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_DOWN) {
|
|
||||||
_km.y_vel = 1;
|
|
||||||
_km.y_down_count = 1;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_START) { // START = menu/enter
|
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
|
||||||
if (_overlayVisible)
|
|
||||||
event.kbd.keycode = event.kbd.ascii = 13;
|
|
||||||
else {
|
|
||||||
event.kbd.keycode = Common::KEYCODE_F5;
|
|
||||||
event.kbd.ascii = Common::ASCII_F5;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_SELECT) { // SELECT = pause
|
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
|
||||||
event.kbd.keycode = event.kbd.ascii = 32;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_FL) {
|
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
|
||||||
event.kbd.keycode = event.kbd.ascii = '0';
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_FR) { // R = ESC
|
|
||||||
event.type = Common::EVENT_KEYDOWN;
|
|
||||||
event.kbd.keycode = event.kbd.ascii = 27;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_FA) {
|
|
||||||
event.type = Common::EVENT_LBUTTONDOWN;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_FB) {
|
|
||||||
event.type = Common::EVENT_RBUTTONDOWN;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BUTTON_UP:
|
|
||||||
if (ev.button == GPC_VK_LEFT) {
|
|
||||||
if (_km.x_vel < 0) {
|
|
||||||
_km.x_vel = 0;
|
|
||||||
_km.x_down_count = 0;
|
|
||||||
}
|
|
||||||
event.type = Common::EVENT_MOUSEMOVE;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_RIGHT) {
|
|
||||||
if (_km.x_vel > 0) {
|
|
||||||
_km.x_vel = 0;
|
|
||||||
_km.x_down_count = 0;
|
|
||||||
}
|
|
||||||
event.type = Common::EVENT_MOUSEMOVE;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_UP) {
|
|
||||||
if (_km.y_vel < 0) {
|
|
||||||
_km.y_vel = 0;
|
|
||||||
_km.y_down_count = 0;
|
|
||||||
}
|
|
||||||
event.type = Common::EVENT_MOUSEMOVE;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_DOWN) {
|
|
||||||
if (_km.y_vel > 0) {
|
|
||||||
_km.y_vel = 0;
|
|
||||||
_km.y_down_count = 0;
|
|
||||||
}
|
|
||||||
event.type = Common::EVENT_MOUSEMOVE;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ev.button == GPC_VK_START) {
|
|
||||||
event.type = Common::EVENT_KEYUP;
|
|
||||||
if (_overlayVisible)
|
|
||||||
event.kbd.keycode = event.kbd.ascii = 13;
|
|
||||||
else {
|
|
||||||
event.kbd.keycode = Common::KEYCODE_F5;
|
|
||||||
event.kbd.ascii = Common::ASCII_F5;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_SELECT) {
|
|
||||||
event.type = Common::EVENT_KEYUP;
|
|
||||||
event.kbd.keycode = event.kbd.ascii = 32;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_FL) {
|
|
||||||
event.type = Common::EVENT_KEYUP;
|
|
||||||
event.kbd.keycode = event.kbd.ascii = '0';
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_FR) {
|
|
||||||
event.type = Common::EVENT_KEYUP;
|
|
||||||
event.kbd.keycode = event.kbd.ascii = 27;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_FA) {
|
|
||||||
event.type = Common::EVENT_LBUTTONUP;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (ev.button == GPC_VK_FB) {
|
|
||||||
event.type = Common::EVENT_RBUTTONUP;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
error("Unknown Common::Event!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gp_getButtonPressed(GPC_VK_LEFT) ||
|
|
||||||
gp_getButtonPressed(GPC_VK_RIGHT) ||
|
|
||||||
gp_getButtonPressed(GPC_VK_UP) ||
|
|
||||||
gp_getButtonPressed(GPC_VK_DOWN)) {
|
|
||||||
event.type = Common::EVENT_MOUSEMOVE;
|
|
||||||
fillMouseEvent(event, _km.x, _km.y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 OSystem_GP32::getMillis() {
|
|
||||||
return GpTickCountGet();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::delayMillis(uint msecs) {
|
|
||||||
int startTime = GpTickCountGet();
|
|
||||||
while (GpTickCountGet() < startTime + msecs);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a new callback timer
|
|
||||||
//FIXME: Add to member
|
|
||||||
int _timerInterval;
|
|
||||||
int (*_timerCallback)(int);
|
|
||||||
|
|
||||||
static void _timerCallbackVoid() {
|
|
||||||
//NP("timer running");
|
|
||||||
_timerCallback(_timerInterval); //FIXME ?? (*_timercallback)(_timerinterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::setTimerCallback(TimerProc callback, int interval) {
|
|
||||||
//NP("OSys::setTimerCallback()");
|
|
||||||
|
|
||||||
int timerNo = 1;
|
|
||||||
|
|
||||||
if (callback == NULL) {
|
|
||||||
GpTimerKill(timerNo);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GpTimerOptSet(timerNo, interval, 0, _timerCallbackVoid) == GPOS_ERR_ALREADY_USED) {
|
|
||||||
error("Timer slot is already used");
|
|
||||||
}
|
|
||||||
|
|
||||||
_timerInterval = interval;
|
|
||||||
_timerCallback = callback;
|
|
||||||
|
|
||||||
GpTimerSet(timerNo);
|
|
||||||
}
|
|
||||||
|
|
||||||
OSystem::MutexRef OSystem_GP32::createMutex() {
|
|
||||||
// NP("OSys::createMutex()");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::lockMutex(MutexRef mutex) {
|
|
||||||
// NP("OSys::lockMutex()");
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::unlockMutex(MutexRef mutex) {
|
|
||||||
// NP("OSys::unlockMutex()");
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::deleteMutex(MutexRef mutex) {
|
|
||||||
// NP("OSys::deleteMutex()");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OSystem_GP32::setSoundCallback(SoundProc proc, void *param) {
|
|
||||||
//NP("OSys::setSoundCallback()");
|
|
||||||
|
|
||||||
GPSOUNDBUF gpSoundBuf;
|
|
||||||
|
|
||||||
ConfMan.setBool("FM_medium_quality", (g_vars.fmQuality == FM_QUALITY_MED));
|
|
||||||
ConfMan.setBool("FM_high_quality", (g_vars.fmQuality == FM_QUALITY_HI));
|
|
||||||
//ConfMan.set("output_rate", (int)g_vars.sampleRate);
|
|
||||||
|
|
||||||
if (ConfMan.hasKey("output_rate"))
|
|
||||||
_samplesPerSec = ConfMan.getInt("output_rate");
|
|
||||||
|
|
||||||
_samplesPerSec = (int)g_vars.sampleRate; //hack
|
|
||||||
|
|
||||||
if (_samplesPerSec == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_samplesPerSec < 0)
|
|
||||||
_samplesPerSec = SAMPLES_PER_SEC;
|
|
||||||
|
|
||||||
// Originally, we always used 2048 samples. This loop will produce the
|
|
||||||
// same result at 22050 Hz, and should hopefully produce something
|
|
||||||
// sensible for other frequencies. Note that it must be a power of two.
|
|
||||||
|
|
||||||
uint32 samples = 0x8000;
|
|
||||||
|
|
||||||
for (;;) {
|
|
||||||
if ((1000 * samples) / _samplesPerSec < 100)
|
|
||||||
break;
|
|
||||||
samples >>= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(_samplesPerSec) {
|
|
||||||
case 44100:
|
|
||||||
case 22050:
|
|
||||||
case 11025:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_samplesPerSec = 11025;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpSoundBuf.freq = _samplesPerSec;
|
|
||||||
gpSoundBuf.format = 16;
|
|
||||||
gpSoundBuf.channels = 2;
|
|
||||||
gpSoundBuf.samples = samples;
|
|
||||||
gpSoundBuf.userdata = param;
|
|
||||||
gpSoundBuf.callback = proc;
|
|
||||||
gp_soundBufStart(&gpSoundBuf);
|
|
||||||
|
|
||||||
// For Safety...
|
|
||||||
GPDEBUG("_samplesPerSec = %d, samples = %d", _samplesPerSec, samples);
|
|
||||||
gp_delay(1000);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::clearSoundCallback() {
|
|
||||||
//NP("OSys::clearSoundCallback()");
|
|
||||||
if (_samplesPerSec != 0)
|
|
||||||
gp_soundBufStop();
|
|
||||||
}
|
|
||||||
|
|
||||||
int OSystem_GP32::getOutputSampleRate() const {
|
|
||||||
//NP("OSys::getOutputSampleRate()");
|
|
||||||
return _samplesPerSec;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::quit() {
|
|
||||||
//NP("OSys::quit()");
|
|
||||||
clearSoundCallback();
|
|
||||||
setTimerCallback(0, 0);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::setWindowCaption(const char *caption) {
|
|
||||||
NP("OSys::setWindowCaption(%s)", caption);
|
|
||||||
}
|
|
||||||
|
|
||||||
void OSystem_GP32::displayMessageOnOSD(const char *msg) {
|
|
||||||
NP("OSys::displayMessageOnOSD(%s)", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
OSystem *OSystem_GP32_create() {
|
|
||||||
NP("OSys::OSystem_GP32_create()");
|
|
||||||
return new OSystem_GP32();
|
|
||||||
}
|
|
|
@ -1,155 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GP32_OSYS_H
|
|
||||||
#define GP32_OSYS_H
|
|
||||||
|
|
||||||
//Standard ScummVM includes.
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
#include "common/system.h"
|
|
||||||
|
|
||||||
#include "engines/engine.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_grap.h"
|
|
||||||
#include "gp32std_input.h"
|
|
||||||
#include "gp32std_sound.h"
|
|
||||||
|
|
||||||
class OSystem_GP32 : public OSystem {
|
|
||||||
public:
|
|
||||||
static OSystem *instance();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
uint16 _screenWidth, _screenHeight;
|
|
||||||
uint8 *_gameScreen;
|
|
||||||
uint16 *_tmpScreen, *_hwScreen;
|
|
||||||
OverlayColor *_overlayBuffer;
|
|
||||||
|
|
||||||
Graphics::Surface _framebuffer;
|
|
||||||
|
|
||||||
int _overlayWidth, _overlayHeight;
|
|
||||||
bool _overlayVisible;
|
|
||||||
uint32 _shakePos;
|
|
||||||
|
|
||||||
// Keyboard mouse emulation
|
|
||||||
struct KbdMouse {
|
|
||||||
int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count;
|
|
||||||
uint32 last_time, delay_time, x_down_time, y_down_time;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct MousePos {
|
|
||||||
int16 x, y, w, h;
|
|
||||||
};
|
|
||||||
|
|
||||||
// mouse
|
|
||||||
KbdMouse _km;
|
|
||||||
bool _mouseVisible;
|
|
||||||
int _mouseX, _mouseY;
|
|
||||||
int _mouseWidth, _mouseHeight;
|
|
||||||
int _mouseHotspotX, _mouseHotspotY;
|
|
||||||
byte _mouseKeyColor;
|
|
||||||
byte *_mouseBuf;
|
|
||||||
|
|
||||||
bool _adjustAspectRatio;
|
|
||||||
|
|
||||||
/** Force full redraw on next updateScreen */
|
|
||||||
bool _forceFull;
|
|
||||||
|
|
||||||
uint16 _currentPalette[256];
|
|
||||||
// uint _paletteDirtyStart, _paletteDirtyEnd;
|
|
||||||
|
|
||||||
int32 _samplesPerSec;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
OSystem_GP32();
|
|
||||||
~OSystem_GP32();
|
|
||||||
|
|
||||||
bool hasFeature(Feature f);
|
|
||||||
void setFeatureState(Feature f, bool enable);
|
|
||||||
bool getFeatureState(Feature f);
|
|
||||||
const GraphicsMode *getSupportedGraphicsModes() const;
|
|
||||||
int getDefaultGraphicsMode() const;
|
|
||||||
bool setGraphicsMode(int mode);
|
|
||||||
bool setGraphicsMode(const char *name);
|
|
||||||
int getGraphicsMode() const;
|
|
||||||
void initSize(uint width, uint height);
|
|
||||||
int16 getHeight();
|
|
||||||
int16 getWidth();
|
|
||||||
void setPalette(const byte *colors, uint start, uint num);
|
|
||||||
void grabPalette(byte *colors, uint start, uint num);
|
|
||||||
|
|
||||||
void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
|
|
||||||
void updateScreen();
|
|
||||||
void setShakePos(int shakeOffset);
|
|
||||||
|
|
||||||
void showOverlay();
|
|
||||||
void hideOverlay();
|
|
||||||
void clearOverlay();
|
|
||||||
void grabOverlay(OverlayColor *buf, int pitch);
|
|
||||||
void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
|
|
||||||
|
|
||||||
virtual Graphics::Surface *lockScreen();
|
|
||||||
virtual void unlockScreen();
|
|
||||||
|
|
||||||
int16 getOverlayHeight();
|
|
||||||
int16 getOverlayWidth();
|
|
||||||
|
|
||||||
OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
|
|
||||||
void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
|
|
||||||
|
|
||||||
bool showMouse(bool visible);
|
|
||||||
|
|
||||||
void warpMouse(int x, int y);
|
|
||||||
void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor = 255, int cursorTargetScale = 1);
|
|
||||||
|
|
||||||
bool pollEvent(Common::Event &event);
|
|
||||||
uint32 getMillis();
|
|
||||||
void delayMillis(uint msecs);
|
|
||||||
|
|
||||||
void setTimerCallback(TimerProc callback, int interval);
|
|
||||||
|
|
||||||
MutexRef createMutex(void);
|
|
||||||
void lockMutex(MutexRef mutex);
|
|
||||||
void unlockMutex(MutexRef mutex);
|
|
||||||
void deleteMutex(MutexRef mutex);
|
|
||||||
|
|
||||||
bool setSoundCallback(SoundProc proc, void *param);
|
|
||||||
void clearSoundCallback();
|
|
||||||
int getOutputSampleRate() const;
|
|
||||||
|
|
||||||
void quit();
|
|
||||||
|
|
||||||
void setWindowCaption(const char *caption);
|
|
||||||
|
|
||||||
void displayMessageOnOSD(const char *msg);
|
|
||||||
|
|
||||||
void fillMouseEvent(Common::Event &event, int x, int y);
|
|
||||||
void handleKbdMouse();
|
|
||||||
};
|
|
||||||
|
|
||||||
#else
|
|
||||||
#warning GP32_OSYS.H Called more then once.
|
|
||||||
#endif /* GP32_H */
|
|
|
@ -1,336 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
//#include "graphics/scaler.h"
|
|
||||||
#include "common/system.h"
|
|
||||||
|
|
||||||
#include "engines/engine.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_grap.h"
|
|
||||||
#include "gp32std_memory.h"
|
|
||||||
|
|
||||||
#define DEBUG_MAX 5
|
|
||||||
char debline[DEBUG_MAX][256];
|
|
||||||
static int debnext = 0;
|
|
||||||
|
|
||||||
void _dprintf(const char *s, ...) {
|
|
||||||
int deba, deb;
|
|
||||||
char buf[1024];
|
|
||||||
va_list va;
|
|
||||||
|
|
||||||
va_start(va, s);
|
|
||||||
vsprintf(buf, s, va);
|
|
||||||
va_end(va);
|
|
||||||
|
|
||||||
strcpy(debline[debnext++], buf);
|
|
||||||
|
|
||||||
if (debnext == DEBUG_MAX)
|
|
||||||
debnext = 0;
|
|
||||||
gp_fillRect(frameBuffer1, 0, 243 - (DEBUG_MAX * 8) - 4, 320, (DEBUG_MAX * 8), 0);
|
|
||||||
|
|
||||||
for (deb = debnext, deba = 0; deb < DEBUG_MAX; deb++, deba++) {
|
|
||||||
//gp_fillRect(frameBuffer1, 0, (243 - (DEBUG_MAX * 8) - 4) + 8 * deba, 320, 8, 0);
|
|
||||||
gp_textOut(frameBuffer1, 0, (240 - (DEBUG_MAX * 8) - 4) + 8 * deba, debline[deb], 0xFFFF);
|
|
||||||
}
|
|
||||||
for (deb = 0; deb < debnext; deb++, deba++) {
|
|
||||||
//gp_fillRect(frameBuffer1, 0, (243 - (DEBUG_MAX * 8) - 4) + 8 * deba, 320, 8, 0);
|
|
||||||
gp_textOut(frameBuffer1, 0, (240 - (DEBUG_MAX * 8) - 4) + 8 * deba, debline[deb], 0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
// gp_delay(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////
|
|
||||||
//String functions
|
|
||||||
char *gp_strcpy(char *dst, const char *src) {
|
|
||||||
char *pDst = dst;
|
|
||||||
|
|
||||||
while (*pDst++ = *src++)
|
|
||||||
;
|
|
||||||
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *gp_strncpy(char *dst, const char *src, size_t count) {
|
|
||||||
char *start = dst;
|
|
||||||
|
|
||||||
while (count && (*dst++ = *src++))
|
|
||||||
count--;
|
|
||||||
|
|
||||||
if (count)
|
|
||||||
while (--count)
|
|
||||||
*dst++ = '\0';
|
|
||||||
|
|
||||||
return start;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *gp_strcat(char *dst, const char *src) {
|
|
||||||
char *pDst = dst;
|
|
||||||
|
|
||||||
while (*pDst)
|
|
||||||
pDst++;
|
|
||||||
|
|
||||||
while (*pDst++ = *src++)
|
|
||||||
;
|
|
||||||
|
|
||||||
return dst;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
char *gp_strdup(const char *str) {
|
|
||||||
char *memory;
|
|
||||||
|
|
||||||
if (!str)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (memory = (char *)gp_malloc(strlen(str) + 1))
|
|
||||||
return gp_strcpy(memory, str);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_strcasecmp(const char *dst, const char *src) {
|
|
||||||
int f, l;
|
|
||||||
do {
|
|
||||||
f = tolower((unsigned char)(*(dst++)));
|
|
||||||
l = tolower((unsigned char)(*(src++)));
|
|
||||||
} while (f && (f == l));
|
|
||||||
|
|
||||||
return f - l;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_strncasecmp(const char *dst, const char *src, size_t count) {
|
|
||||||
int f,l;
|
|
||||||
|
|
||||||
if (count) {
|
|
||||||
do {
|
|
||||||
f = tolower((unsigned char)(*(dst++)));
|
|
||||||
l = tolower((unsigned char)(*(src++)));
|
|
||||||
} while (--count && f && (f == l));
|
|
||||||
return f - l;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//FIXME: Handle LONG string
|
|
||||||
void gp_sprintf(char *str, const char *fmt, ...) {
|
|
||||||
char s[512];
|
|
||||||
va_list marker;
|
|
||||||
|
|
||||||
va_start(marker, fmt);
|
|
||||||
vsnprintf(s, 512, fmt, marker);
|
|
||||||
va_end(marker);
|
|
||||||
|
|
||||||
gp_strcpy(str, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_printf(const char *fmt, ...) {
|
|
||||||
char s[256];
|
|
||||||
va_list marker;
|
|
||||||
|
|
||||||
va_start(marker, fmt);
|
|
||||||
vsnprintf(s, 256, fmt, marker);
|
|
||||||
va_end(marker);
|
|
||||||
|
|
||||||
_dprintf("%s", s);
|
|
||||||
//gp_delay(100);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_delay(uint32 msecs) {
|
|
||||||
int startTime = GpTickCountGet();
|
|
||||||
while (GpTickCountGet() < startTime + msecs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_clockSpeedChange(int freq, int magic, int div) {
|
|
||||||
#define rTCFG0 (*(volatile unsigned *)0x15100000)
|
|
||||||
#define rTCFG1 (*(volatile unsigned *)0x15100004)
|
|
||||||
#define rTCNTB4 (*(volatile unsigned *)0x1510003c)
|
|
||||||
unsigned int pclk;
|
|
||||||
unsigned int prescaler0;
|
|
||||||
|
|
||||||
// Change CPU Speed
|
|
||||||
GpClockSpeedChange(freq, magic, div);
|
|
||||||
pclk = GpPClkGet();
|
|
||||||
|
|
||||||
// Repair SDK timer - it forgets to set prescaler
|
|
||||||
prescaler0 = (pclk / (8000 * 40)) - 1;
|
|
||||||
rTCFG0 = (rTCFG0 & 0xFFFFFF00) | prescaler0;
|
|
||||||
rTCFG1 = 0x30033;
|
|
||||||
|
|
||||||
// Repair GpTickCountGet
|
|
||||||
rTCNTB4 = pclk / 1600;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_setCpuSpeed(int freq) {
|
|
||||||
// Default value for 40 mhz
|
|
||||||
static int CLKDIV = 0x48013;
|
|
||||||
static int MCLK = 40000000;
|
|
||||||
static int CLKMODE = 0;
|
|
||||||
static int HCLK = 40000000;
|
|
||||||
static int PCLK = 40000000;
|
|
||||||
|
|
||||||
switch (freq) {
|
|
||||||
// overclocked
|
|
||||||
case 168: { CLKDIV = 0x14000; MCLK = 168000000; CLKMODE = 3; break; }
|
|
||||||
case 172: { CLKDIV = 0x23010; MCLK = 172000000; CLKMODE = 3; break; }
|
|
||||||
case 176: { CLKDIV = 0x24010; MCLK = 176000000; CLKMODE = 3; break; }
|
|
||||||
case 180: { CLKDIV = 0x16000; MCLK = 180000000; CLKMODE = 3; break; }
|
|
||||||
case 184: { CLKDIV = 0x26010; MCLK = 184000000; CLKMODE = 3; break; }
|
|
||||||
case 188: { CLKDIV = 0x27010; MCLK = 188000000; CLKMODE = 3; break; }
|
|
||||||
case 192: { CLKDIV = 0x18000; MCLK = 192000000; CLKMODE = 3; break; }
|
|
||||||
case 196: { CLKDIV = 0x29010; MCLK = 196000000; CLKMODE = 3; break; }
|
|
||||||
case 200: { CLKDIV = 0x2A010; MCLK = 200000000; CLKMODE = 3; break; }
|
|
||||||
case 204: { CLKDIV = 0x2b010; MCLK = 204000000; CLKMODE = 3; break; }
|
|
||||||
case 208: { CLKDIV = 0x2c010; MCLK = 208000000; CLKMODE = 3; break; }
|
|
||||||
case 212: { CLKDIV = 0x2d010; MCLK = 212000000; CLKMODE = 3; break; }
|
|
||||||
case 216: { CLKDIV = 0x2e010; MCLK = 216000000; CLKMODE = 3; break; }
|
|
||||||
case 220: { CLKDIV = 0x2f010; MCLK = 220000000; CLKMODE = 3; break; }
|
|
||||||
case 224: { CLKDIV = 0x30010; MCLK = 224000000; CLKMODE = 3; break; }
|
|
||||||
case 228: { CLKDIV = 0x1e000; MCLK = 228000000; CLKMODE = 3; break; }
|
|
||||||
case 232: { CLKDIV = 0x32010; MCLK = 232000000; CLKMODE = 3; break; }
|
|
||||||
case 236: { CLKDIV = 0x33010; MCLK = 236000000; CLKMODE = 3; break; }
|
|
||||||
case 240: { CLKDIV = 0x20000; MCLK = 240000000; CLKMODE = 3; break; }
|
|
||||||
case 244: { CLKDIV = 0x35010; MCLK = 244000000; CLKMODE = 3; break; }
|
|
||||||
case 248: { CLKDIV = 0x36010; MCLK = 248000000; CLKMODE = 3; break; }
|
|
||||||
case 252: { CLKDIV = 0x22000; MCLK = 252000000; CLKMODE = 3; break; }
|
|
||||||
case 256: { CLKDIV = 0x38010; MCLK = 256000000; CLKMODE = 3; break; }
|
|
||||||
|
|
||||||
// normal
|
|
||||||
// case 166: { CLKDIV = 0x4B011; MCLK = 166000000; CLKMODE = 3; break; }
|
|
||||||
case 166: { CLKDIV = 0x2f001; MCLK = 165000000; CLKMODE = 3; break; }
|
|
||||||
case 164: { CLKDIV = 0x4a011; MCLK = 164000000; CLKMODE = 3; break; }
|
|
||||||
case 160: { CLKDIV = 0x48011; MCLK = 160000000; CLKMODE = 3; break; }
|
|
||||||
case 156: { CLKDIV = 0x2c001; MCLK = 156000000; CLKMODE = 3; break; }
|
|
||||||
case 144: { CLKDIV = 0x28001; MCLK = 144000000; CLKMODE = 3; break; }
|
|
||||||
case 133: { CLKDIV = 0x51021; MCLK = 133500000; CLKMODE = 2; break; }
|
|
||||||
case 132: { CLKDIV = 0x3a011; MCLK = 132000000; CLKMODE = 3; break; }
|
|
||||||
case 120: { CLKDIV = 0x24001; MCLK = 120000000; CLKMODE = 2; break; }
|
|
||||||
case 100: { CLKDIV = 0x2b011; MCLK = 102000000; CLKMODE = 2; break; }
|
|
||||||
case 66: { CLKDIV = 0x25002; MCLK = 67500000; CLKMODE = 2; break; }
|
|
||||||
case 50: { CLKDIV = 0x2a012; MCLK = 50000000; CLKMODE = 0; break; }
|
|
||||||
// case 40: { CLKDIV = 0x48013; MCLK = 40000000; CLKMODE = 0; break; }
|
|
||||||
case 40: { CLKDIV = 0x48013; MCLK = 40000000; CLKMODE = 1; break; }
|
|
||||||
// case 33: { CLKDIV = 0x25003; MCLK = 33750000; CLKMODE = 0; break; }
|
|
||||||
case 33: { CLKDIV = 0x25003; MCLK = 33750000; CLKMODE = 2; break; }
|
|
||||||
case 22: { CLKDIV = 0x33023; MCLK = 22125000; CLKMODE = 0; break; }
|
|
||||||
default:
|
|
||||||
error("Invalid CPU frequency!");
|
|
||||||
}
|
|
||||||
if (CLKMODE == 0) { HCLK = MCLK; PCLK = MCLK; }
|
|
||||||
if (CLKMODE == 1) { HCLK = MCLK; PCLK = MCLK / 2; }
|
|
||||||
if (CLKMODE == 2) { HCLK = MCLK / 2; PCLK = MCLK / 2; }
|
|
||||||
if (CLKMODE == 3) { HCLK = MCLK / 2; PCLK = MCLK / 4; }
|
|
||||||
|
|
||||||
gp_clockSpeedChange(MCLK, CLKDIV, CLKMODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_Reset() {
|
|
||||||
gp_setCpuSpeed(66);
|
|
||||||
asm volatile("swi #4\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_exit(int code) {
|
|
||||||
if (!code) {
|
|
||||||
printf(" ----------------------------------------");
|
|
||||||
printf(" Your GP32 is now restarting... ");
|
|
||||||
printf(" ----------------------------------------");
|
|
||||||
printf("");
|
|
||||||
|
|
||||||
gp_delay(3000);
|
|
||||||
|
|
||||||
GpAppExit();
|
|
||||||
} else {
|
|
||||||
printf("Exit Code %d", code);
|
|
||||||
while (1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Debug functions
|
|
||||||
void GPDEBUG(const char *fmt, ...) {
|
|
||||||
char s[256];
|
|
||||||
va_list marker;
|
|
||||||
|
|
||||||
va_start(marker, fmt);
|
|
||||||
vsnprintf(s, 256, fmt, marker);
|
|
||||||
va_end(marker);
|
|
||||||
|
|
||||||
_dprintf("%s", s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NP(const char *fmt, ...) {
|
|
||||||
// return;
|
|
||||||
char s[256];
|
|
||||||
va_list marker;
|
|
||||||
|
|
||||||
va_start(marker, fmt);
|
|
||||||
vsnprintf(s, 256, fmt, marker);
|
|
||||||
va_end(marker);
|
|
||||||
|
|
||||||
_dprintf("NP:%s", s);
|
|
||||||
gp_delay(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LP(const char *fmt, ...) {
|
|
||||||
// return;
|
|
||||||
char s[256];
|
|
||||||
va_list marker;
|
|
||||||
|
|
||||||
va_start(marker, fmt);
|
|
||||||
vsnprintf(s, 256, fmt, marker);
|
|
||||||
va_end(marker);
|
|
||||||
|
|
||||||
_dprintf("LP:%s", s);
|
|
||||||
gp_delay(300);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SP(const char *fmt, ...) {
|
|
||||||
// return;
|
|
||||||
char s[256];
|
|
||||||
va_list marker;
|
|
||||||
|
|
||||||
va_start(marker, fmt);
|
|
||||||
vsnprintf(s, 256, fmt, marker);
|
|
||||||
va_end(marker);
|
|
||||||
|
|
||||||
_dprintf("SP:%s", s);
|
|
||||||
gp_delay(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BP(const char *fmt, ...) {
|
|
||||||
// return;
|
|
||||||
char s[256];
|
|
||||||
va_list marker;
|
|
||||||
|
|
||||||
va_start(marker, fmt);
|
|
||||||
vsnprintf(s, 256, fmt, marker);
|
|
||||||
va_end(marker);
|
|
||||||
|
|
||||||
_dprintf("BP:%s", s);
|
|
||||||
gp_delay(2000);
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GP32STD_H
|
|
||||||
#define __GP32STD_H
|
|
||||||
|
|
||||||
#include <gpfont.h>
|
|
||||||
#include <gpfont_port.h>
|
|
||||||
#include <gpgraphic.h>
|
|
||||||
#include <gpmm.h>
|
|
||||||
#include <gpmem.h>
|
|
||||||
#include <gpos_def.h>
|
|
||||||
#include <gpstdio.h>
|
|
||||||
#include <gpstdlib.h>
|
|
||||||
#include <gpdef.h>
|
|
||||||
|
|
||||||
#define LCD_WIDTH 320
|
|
||||||
#define LCD_HEIGHT 240
|
|
||||||
|
|
||||||
extern char * gp_strcpy(char *dst, const char *src);
|
|
||||||
extern char * gp_strncpy(char *dst, const char *src, size_t count);
|
|
||||||
extern char * gp_strcat(char *dst, const char *src);
|
|
||||||
extern char * gp_strdup(const char *str);
|
|
||||||
extern int gp_strcasecmp(const char *dst, const char *src);
|
|
||||||
extern int gp_strncasecmp(const char *dst, const char *src, size_t count);
|
|
||||||
extern void gp_sprintf(char *str, const char *fmt, ...);
|
|
||||||
|
|
||||||
extern void gp_setCpuSpeed(int freq);
|
|
||||||
extern int gp_printf(const char *fmt, ...);
|
|
||||||
extern void gp_delay(unsigned long msecs);
|
|
||||||
extern void gp_exit(int code);
|
|
||||||
|
|
||||||
extern void GPDEBUG(const char *fmt, ...);
|
|
||||||
extern void LP(const char *fmt, ...);
|
|
||||||
extern void NP(const char *fmt, ...);
|
|
||||||
extern void SP(const char *fmt, ...);
|
|
||||||
extern void BP(const char *fmt, ...);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,320 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
//#include "graphics/scaler.h"
|
|
||||||
#include "common/system.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_file.h"
|
|
||||||
|
|
||||||
FILE *gp_stderr = NULL;
|
|
||||||
FILE *gp_stdout = NULL;
|
|
||||||
FILE *gp_stdin = NULL;
|
|
||||||
|
|
||||||
// Cache Idea / Code borrowed from the ps2 port
|
|
||||||
#define USE_CACHE
|
|
||||||
|
|
||||||
//////////////////
|
|
||||||
//File functions
|
|
||||||
|
|
||||||
|
|
||||||
// CACHE
|
|
||||||
inline bool gp_cacheInPos(GPFILE *stream) {
|
|
||||||
return (stream->cachePos <= stream->filePos && stream->filePos < stream->cachePos + stream->bytesInCache);
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_cacheMiss(GPFILE *stream) {
|
|
||||||
unsigned long readcount = 0;
|
|
||||||
|
|
||||||
int copyLen = stream->fileSize - stream->filePos;
|
|
||||||
if (copyLen > FCACHE_SIZE)
|
|
||||||
copyLen = FCACHE_SIZE;
|
|
||||||
|
|
||||||
stream->cachePos = stream->filePos;
|
|
||||||
stream->cacheBufOffs = 0;
|
|
||||||
stream->bytesInCache = copyLen;
|
|
||||||
|
|
||||||
ERR_CODE err = GpFileRead(stream->handle, stream->cacheData, copyLen, &readcount);
|
|
||||||
|
|
||||||
stream->physFilePos += copyLen;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_flushWriteCache(GPFILE *stream) {
|
|
||||||
if (stream->bytesInCache == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ERR_CODE err = GpFileWrite(stream->handle, stream->cacheData, stream->bytesInCache); // flush cache
|
|
||||||
|
|
||||||
stream->filePos += stream->bytesInCache;
|
|
||||||
stream->physFilePos += stream->bytesInCache;
|
|
||||||
stream->bytesInCache = 0;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
GPFILE *gp_fopen(const char *fileName, const char *openMode) {
|
|
||||||
uint32 mode;
|
|
||||||
GPFILE *file;
|
|
||||||
ERR_CODE err;
|
|
||||||
char tempPath[256];
|
|
||||||
|
|
||||||
if (!strchr(fileName, '.')) {
|
|
||||||
sprintf(tempPath, "%s.", fileName);
|
|
||||||
fileName = tempPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = new GPFILE;
|
|
||||||
|
|
||||||
// NP("%s(\"%s\", \"%s\")", __FUNCTION__, fileName, openMode);
|
|
||||||
|
|
||||||
// FIXME add binary/text support
|
|
||||||
if (tolower(openMode[0]) == 'r') {
|
|
||||||
mode = OPEN_R;
|
|
||||||
GpFileGetSize(fileName, &file->fileSize);
|
|
||||||
err = GpFileOpen(fileName, mode, &file->handle);
|
|
||||||
} else if (tolower(openMode[0]) == 'w') {
|
|
||||||
file->fileSize = 0;
|
|
||||||
mode = OPEN_W;
|
|
||||||
err = GpFileCreate(fileName, ALWAYS_CREATE, &file->handle);
|
|
||||||
} else if (tolower(openMode[0]) == 'a') {
|
|
||||||
warning("We do not support 'a' file open mode.");
|
|
||||||
delete file;
|
|
||||||
return NULL;
|
|
||||||
} else {
|
|
||||||
error("wrong file mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!file) {
|
|
||||||
error("%s: cannot create FILE structure", __FUNCTION__);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err) {
|
|
||||||
printf("gp_fopen(): IO error %d", err);
|
|
||||||
delete file;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
file->mode = mode;
|
|
||||||
file->cachePos = 0;
|
|
||||||
file->filePos = 0;
|
|
||||||
file->cacheBufOffs = 0;
|
|
||||||
file->physFilePos = 0;
|
|
||||||
file->bytesInCache = 0;
|
|
||||||
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_fclose(GPFILE *stream) {
|
|
||||||
if (!stream) {
|
|
||||||
//warning("closing null file");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if (*(uint32 *)((char *)stream - sizeof(uint32)) == 0x4321) {
|
|
||||||
debug(0, "Double closing", __FUNCTION__);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef USE_CACHE
|
|
||||||
if (stream->bytesInCache && stream->mode == OPEN_W) {
|
|
||||||
gp_flushWriteCache(stream);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ERR_CODE err = GpFileClose(stream->handle);
|
|
||||||
delete stream;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_fseek(GPFILE *stream, long offset, int whence) {
|
|
||||||
switch (whence) {
|
|
||||||
case SEEK_SET:
|
|
||||||
whence = FROM_BEGIN;
|
|
||||||
break;
|
|
||||||
case SEEK_CUR:
|
|
||||||
whence = FROM_CURRENT;
|
|
||||||
break;
|
|
||||||
case SEEK_END:
|
|
||||||
whence = FROM_END;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ERR_CODE err;
|
|
||||||
#ifdef USE_CACHE
|
|
||||||
// need to flush cache
|
|
||||||
if (stream->mode == OPEN_W) { // write
|
|
||||||
gp_flushWriteCache(stream);
|
|
||||||
err = GpFileSeek(stream->handle, whence, offset, (long *)&stream->filePos);
|
|
||||||
} else { // read
|
|
||||||
if (whence == SEEK_CUR)
|
|
||||||
offset += stream->physFilePos - stream->filePos;
|
|
||||||
|
|
||||||
err = GpFileSeek(stream->handle, whence, offset, (long *)&stream->physFilePos);
|
|
||||||
stream->filePos = stream->physFilePos;
|
|
||||||
|
|
||||||
if (!gp_cacheInPos(stream)) { // cache miss
|
|
||||||
gp_cacheMiss(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
//return 0; //FIXME?
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t gp_fread(void *ptr, size_t size, size_t n, GPFILE *stream) {
|
|
||||||
unsigned int len = size * n;
|
|
||||||
uint8 *dest = (uint8 *)ptr;
|
|
||||||
|
|
||||||
#ifdef USE_CACHE
|
|
||||||
while (len && !gp_feof(stream)) {
|
|
||||||
if (gp_cacheInPos(stream)) {
|
|
||||||
uint32 startPos = (stream->cacheBufOffs + (stream->filePos - stream->cachePos)) % FCACHE_SIZE;
|
|
||||||
uint32 copyLen = stream->bytesInCache - (stream->filePos - stream->cachePos);
|
|
||||||
if (copyLen > len)
|
|
||||||
copyLen = len;
|
|
||||||
if (startPos + copyLen > FCACHE_SIZE)
|
|
||||||
copyLen = FCACHE_SIZE - startPos;
|
|
||||||
|
|
||||||
memcpy(dest, stream->cacheData + startPos, copyLen);
|
|
||||||
|
|
||||||
stream->filePos += copyLen;
|
|
||||||
dest += copyLen;
|
|
||||||
len -= copyLen;
|
|
||||||
} else { // cache miss or cache empty
|
|
||||||
gp_cacheMiss(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ulong readcount = 0;
|
|
||||||
ERR_CODE err = GpFileRead(stream->handle, ptr, len, &readcount);
|
|
||||||
stream->physFilePos += len;
|
|
||||||
stream->filePos += len;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what
|
|
||||||
// needs fixing, or remove it!
|
|
||||||
return 1; //readcount / size; //FIXME
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t gp_fwrite(const void *ptr, size_t size, size_t n, GPFILE *stream) {
|
|
||||||
int len = size * n;
|
|
||||||
uint8 *srcBuf = (uint8 *)ptr;
|
|
||||||
|
|
||||||
if (!stream) {
|
|
||||||
//warning("writing to null file");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_CACHE
|
|
||||||
while (len) {
|
|
||||||
uint32 copyLen;
|
|
||||||
if (stream->bytesInCache + len > FCACHE_SIZE)
|
|
||||||
copyLen = FCACHE_SIZE - stream->bytesInCache;
|
|
||||||
else
|
|
||||||
copyLen = len;
|
|
||||||
|
|
||||||
srcBuf += copyLen;
|
|
||||||
len -= copyLen;
|
|
||||||
|
|
||||||
if (stream->bytesInCache == FCACHE_SIZE) {
|
|
||||||
gp_flushWriteCache(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ERR_CODE err = GpFileWrite(stream->handle, ptr, len);
|
|
||||||
if (!err)
|
|
||||||
return n;
|
|
||||||
else
|
|
||||||
return -err;
|
|
||||||
#endif
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
long gp_ftell(GPFILE *stream) {
|
|
||||||
ulong pos = 0;
|
|
||||||
pos = stream->filePos;
|
|
||||||
//ERR_CODE err = GpFileSeek(stream->handle, FROM_CURRENT, 0, (long*)&pos);
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_clearerr(GPFILE *stream)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_feof(GPFILE *stream) {
|
|
||||||
return (unsigned long)gp_ftell(stream) >= stream->fileSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
char gp_fgetc(GPFILE *stream) {
|
|
||||||
char c[1];
|
|
||||||
|
|
||||||
gp_fread(&c[0], 1, 1, stream);
|
|
||||||
return c[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
char *gp_fgets(char *s, int n, GPFILE *stream) {
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while (!gp_feof(stream) && i < n) {
|
|
||||||
gp_fread(&s[i], 1, 1, stream);
|
|
||||||
if (s[i] == '\n') {
|
|
||||||
s[i + 1] = 0;
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (gp_feof(stream))
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_fprintf(GPFILE *stream, const char *fmt, ...) {
|
|
||||||
char s[256];
|
|
||||||
va_list marker;
|
|
||||||
|
|
||||||
va_start(marker, fmt);
|
|
||||||
vsnprintf(s, 256, fmt, marker);
|
|
||||||
va_end(marker);
|
|
||||||
|
|
||||||
return gp_fwrite(s, 1, strlen(s), stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_fflush(GPFILE *stream) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_ferror(GPFILE *stream) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,61 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GP32STD_FILE_H
|
|
||||||
#define __GP32STD_FILE_H
|
|
||||||
|
|
||||||
#define FCACHE_SIZE 8 * 1024
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
F_HANDLE handle;
|
|
||||||
unsigned long mode;
|
|
||||||
unsigned long fileSize;
|
|
||||||
unsigned long filePos;
|
|
||||||
unsigned long physFilePos;
|
|
||||||
unsigned long cachePos;
|
|
||||||
unsigned long cacheBufOffs;
|
|
||||||
unsigned long bytesInCache;
|
|
||||||
unsigned char cacheData[FCACHE_SIZE];
|
|
||||||
} GPFILE;
|
|
||||||
|
|
||||||
extern GPFILE *gp_stderr;
|
|
||||||
extern GPFILE *gp_stdout;
|
|
||||||
extern GPFILE *gp_stdin;
|
|
||||||
|
|
||||||
extern GPFILE * gp_fopen(const char *filename, const char *mode);
|
|
||||||
extern int gp_fclose(GPFILE *stream);
|
|
||||||
extern int gp_fseek(GPFILE *stream, long offset, int whence);
|
|
||||||
extern size_t gp_fread(void *ptr, size_t size, size_t n, GPFILE *stream);
|
|
||||||
extern size_t gp_fwrite(const void *ptr, size_t size, size_t n, GPFILE *stream);
|
|
||||||
extern long gp_ftell(GPFILE *stream);
|
|
||||||
extern void gp_clearerr(GPFILE *stream);
|
|
||||||
extern int gp_feof(GPFILE *stream);
|
|
||||||
extern char gp_fgetc(GPFILE *stream);
|
|
||||||
extern char * gp_fgets(char *s, int n, GPFILE *stream);
|
|
||||||
extern int gp_fflush(GPFILE *stream);
|
|
||||||
extern int gp_ferror(GPFILE *stream);
|
|
||||||
extern int gp_fprintf(GPFILE *stream, const char *fmt, ...);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,148 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
#include "common/system.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_grap.h"
|
|
||||||
|
|
||||||
#include "globals.h"
|
|
||||||
|
|
||||||
GPDRAWSURFACE lcdSurface[2];
|
|
||||||
|
|
||||||
uint8 flipIndex = 1;
|
|
||||||
|
|
||||||
uint16 *frameBuffer1;
|
|
||||||
uint16 *frameBuffer2;
|
|
||||||
|
|
||||||
uint8 gammaLUT[256];
|
|
||||||
uint8 gammaLUTInv[256];
|
|
||||||
|
|
||||||
extern const unsigned char fontresEng1[];
|
|
||||||
extern const unsigned char fontresKor1[];
|
|
||||||
|
|
||||||
void gp_putBitmap8x16(uint16 *frameBuffer, int x, int y, byte *lpBitmap, uint16 wColor) {
|
|
||||||
byte *pBitmap = lpBitmap;
|
|
||||||
for (int nRow = 0; nRow < 12; nRow ++) {
|
|
||||||
byte data = *pBitmap++;
|
|
||||||
for (int nCol = 0; nCol < 7; nCol ++) {
|
|
||||||
if (data & 0x80)
|
|
||||||
if (x + nCol >= 0 && y + nRow >= 0 && x + nCol < 320 && y + nRow < 240)
|
|
||||||
gpd_drawPixel16(frameBuffer, x + nCol, y + nRow, wColor);
|
|
||||||
|
|
||||||
data <<= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_putEngFont(uint16 *frameBuffer, int x, int y, char c, uint16 wColor) {
|
|
||||||
byte *pBitmap = (byte *) &fontresEng1[c * 16];
|
|
||||||
gp_putBitmap8x16(frameBuffer, x, y, pBitmap, wColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_textOut(uint16 *frameBuffer, int x, int y, char* lpszText, uint16 wColor) {
|
|
||||||
// TODO: Handle korean font
|
|
||||||
int nPos = x;
|
|
||||||
char* pszText = lpszText;
|
|
||||||
|
|
||||||
while (*pszText != '\0') {
|
|
||||||
if (*pszText == '\n') {
|
|
||||||
nPos = x;
|
|
||||||
y += 8;
|
|
||||||
} else {
|
|
||||||
gp_putEngFont(frameBuffer, nPos, y, *pszText, wColor);
|
|
||||||
nPos += 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
pszText++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_fillRect(uint16 *frameBuffer, int16 x, int16 y, int16 w, int16 h, uint16 color) {
|
|
||||||
uint16 *buffer = &frameBuffer[(240 - (y + h)) + (240 * x)];
|
|
||||||
for (int i = 0; i < w; i++) {
|
|
||||||
for (int j = 0; j < h; j++) {
|
|
||||||
*buffer++ = color;
|
|
||||||
}
|
|
||||||
buffer += 240 - h;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_initGammaTable(float value)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 256; i++) {
|
|
||||||
if (value == 1.0f) {
|
|
||||||
gammaLUT[i] = i;
|
|
||||||
gammaLUTInv[i] = i;
|
|
||||||
} else {
|
|
||||||
gammaLUT[i] = (uint8)(pow((double)i / 256, 1 / (double)value) * 256);
|
|
||||||
gammaLUTInv[i] = (uint8)(pow((double)i / 256, (double)value) * 256);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint16 gp_RGBTo16(uint16 r, uint16 g, uint16 b) {
|
|
||||||
// GP32 16bit color 5551
|
|
||||||
if (g_vars.gammaRamp != 10000) {
|
|
||||||
r = gammaLUT[r];
|
|
||||||
g = gammaLUT[g];
|
|
||||||
b = gammaLUT[b];
|
|
||||||
}
|
|
||||||
return (((r >> 3) & 0x1F) << 11) | (((g >> 3) & 0x1F) << 6) | ((b >> 3) & 0x1F) << 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_16ToRGB(uint16 color, uint8 *r, uint8 *g, uint8 *b) {
|
|
||||||
*r = ((((color) >> 11) & 0x1F) << 3);
|
|
||||||
*g = ((((color) >> 6) & 0x1F) << 3); //(((color>>5)&0x3F) << 2);
|
|
||||||
*b = ((((color) >> 1) & 0x1F) << 3); //((color&0x1F) << 3);
|
|
||||||
|
|
||||||
if (g_vars.gammaRamp != 10000) {
|
|
||||||
*r = gammaLUTInv[*r];
|
|
||||||
*g = gammaLUTInv[*g];
|
|
||||||
*b = gammaLUTInv[*b];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_flipScreen() {
|
|
||||||
uint16 *frameBuffer1_old = frameBuffer1;
|
|
||||||
uint16 *frameBuffer2_old = frameBuffer2;
|
|
||||||
|
|
||||||
GpSurfaceFlip(&lcdSurface[flipIndex]);
|
|
||||||
flipIndex = 1 - flipIndex;
|
|
||||||
frameBuffer1 = frameBuffer2_old;
|
|
||||||
frameBuffer2 = frameBuffer1_old;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_initFrameBuffer() {
|
|
||||||
GpLcdSurfaceGet(&lcdSurface[0], 0);
|
|
||||||
GpLcdSurfaceGet(&lcdSurface[1], 1);
|
|
||||||
GpSurfaceSet(&lcdSurface[0]);
|
|
||||||
frameBuffer1 = (uint16 *)lcdSurface[0].ptbuffer;
|
|
||||||
frameBuffer2 = (uint16 *)lcdSurface[1].ptbuffer;
|
|
||||||
|
|
||||||
memset(frameBuffer1, 0xFF, LCD_WIDTH * LCD_HEIGHT * sizeof(uint16));
|
|
||||||
memset(frameBuffer2, 0xFF, LCD_WIDTH * LCD_HEIGHT * sizeof(uint16));
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GP32STD_GRAP_H
|
|
||||||
#define __GP32STD_GRAP_H
|
|
||||||
|
|
||||||
extern GPDRAWSURFACE lcdSurface[2];
|
|
||||||
extern uint8 flipIndex;
|
|
||||||
|
|
||||||
extern uint16 *frameBuffer1;
|
|
||||||
extern uint16 *frameBuffer2;
|
|
||||||
|
|
||||||
extern void gp_fillRect(uint16 *frameBuffer, int16 x, int16 y, int16 w, int16 h, uint16 color);
|
|
||||||
extern uint16 gp_RGBTo16(uint16 r, uint16 g, uint16 b);
|
|
||||||
extern void gp_16ToRGB(uint16 color, uint8 *r, uint8 *g, uint8 *b);
|
|
||||||
|
|
||||||
extern void gp_textOut(uint16 *frameBuffer, int x, int y, char* lpszText, uint16 wColor);
|
|
||||||
|
|
||||||
extern void gp_initGammaTable(float value);
|
|
||||||
extern void gp_initFrameBuffer();
|
|
||||||
extern void gp_flipScreen();
|
|
||||||
|
|
||||||
#define gpd_drawPixel16(dst,x,y,color) (dst)[(239 - (y)) + (240 * (x))] = (color)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,210 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_input.h"
|
|
||||||
|
|
||||||
static uint32 buttonState = 0;
|
|
||||||
static uint16 buttonPressState = 0;
|
|
||||||
|
|
||||||
#define GET_BUTTON_PRESSED(a) (buttonPressState & (a))
|
|
||||||
#define ON_BUTTON_PRESSED(a) (buttonPressState |= (a))
|
|
||||||
#define OFF_BUTTON_PRESSED(a) (buttonPressState &= ~(a))
|
|
||||||
|
|
||||||
#define GET_BUTTON_DOWN(a) (buttonState & (a) << 12)
|
|
||||||
#define ON_BUTTON_DOWN(a) buttonState |= ((a) << 12)
|
|
||||||
#define OFF_BUTTON_DOWN(a) buttonState &= ~((a) << 12)
|
|
||||||
|
|
||||||
#define GET_BUTTON_UP(a) (buttonState & (a))
|
|
||||||
#define ON_BUTTON_UP(a) buttonState |= (a)
|
|
||||||
#define OFF_BUTTON_UP(a) buttonState &= ~(a)
|
|
||||||
|
|
||||||
#define rKEY_A 0x4000
|
|
||||||
#define rKEY_B 0x2000
|
|
||||||
#define rKEY_L 0x1000
|
|
||||||
#define rKEY_R 0x8000
|
|
||||||
#define rKEY_UP 0x0800
|
|
||||||
#define rKEY_DOWN 0x0200
|
|
||||||
#define rKEY_LEFT 0x0100
|
|
||||||
#define rKEY_RIGHT 0x0400
|
|
||||||
#define rKEY_START 0x0040
|
|
||||||
#define rKEY_SELECT 0x0080
|
|
||||||
#define rPBDAT (*(volatile unsigned *)0x1560000c)
|
|
||||||
#define rPEDAT (*(volatile unsigned *)0x15600030)
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
GP32 Input mappings - Returns Button Pressed.
|
|
||||||
****************************************************************/
|
|
||||||
int gp_trapKey() {
|
|
||||||
int value = 0;
|
|
||||||
|
|
||||||
unsigned long gpb = rPBDAT; // 0x156
|
|
||||||
unsigned long gpe = rPEDAT;
|
|
||||||
|
|
||||||
if ((gpb & rKEY_LEFT) == 0)
|
|
||||||
value |= GPC_VK_LEFT;
|
|
||||||
if ((gpb & rKEY_RIGHT) == 0)
|
|
||||||
value |= GPC_VK_RIGHT;
|
|
||||||
if ((gpb & rKEY_UP) == 0)
|
|
||||||
value |= GPC_VK_UP;
|
|
||||||
if ((gpb & rKEY_DOWN) == 0)
|
|
||||||
value |= GPC_VK_DOWN;
|
|
||||||
if ((gpb & rKEY_A) == 0)
|
|
||||||
value |= GPC_VK_FA;
|
|
||||||
if ((gpb & rKEY_B) == 0)
|
|
||||||
value |= GPC_VK_FB;
|
|
||||||
if ((gpb & rKEY_L) == 0)
|
|
||||||
value |= GPC_VK_FL;
|
|
||||||
if ((gpb & rKEY_R) == 0)
|
|
||||||
value |= GPC_VK_FR;
|
|
||||||
if ((gpe & rKEY_SELECT) == 0)
|
|
||||||
value |= GPC_VK_SELECT;
|
|
||||||
if ((gpe & rKEY_START) == 0)
|
|
||||||
value |= GPC_VK_START;
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gp_getButtonEvent(uint32 *nKeyUD, uint16 *nKeyP) {
|
|
||||||
// int nKey = GpKeyGet();
|
|
||||||
int nKey = gp_trapKey();
|
|
||||||
|
|
||||||
const int keyBitMask[10] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
|
||||||
OFF_BUTTON_DOWN(keyBitMask[i]);
|
|
||||||
OFF_BUTTON_UP(keyBitMask[i]);
|
|
||||||
if (nKey & keyBitMask[i]) {
|
|
||||||
if (!GET_BUTTON_PRESSED(keyBitMask[i])) {
|
|
||||||
// GPDEBUG("DOWN %d", i);
|
|
||||||
ON_BUTTON_PRESSED(keyBitMask[i]);
|
|
||||||
ON_BUTTON_DOWN(keyBitMask[i]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (GET_BUTTON_PRESSED(keyBitMask[i])) {
|
|
||||||
// GPDEBUG("UP %d", i);
|
|
||||||
OFF_BUTTON_PRESSED(keyBitMask[i]);
|
|
||||||
ON_BUTTON_UP(keyBitMask[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GPDEBUG("%08x %04x", buttonState, buttonPressState);
|
|
||||||
*nKeyUD = buttonState;
|
|
||||||
*nKeyP = buttonPressState;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAX_EVENTS 32
|
|
||||||
|
|
||||||
struct EventQueue {
|
|
||||||
protected:
|
|
||||||
int front, rear;
|
|
||||||
int numElement;
|
|
||||||
GP32BtnEvent event[MAX_EVENTS];
|
|
||||||
|
|
||||||
public:
|
|
||||||
void push(GP32BtnEvent *ev) {
|
|
||||||
if ((rear + 1) % MAX_EVENTS == front) {
|
|
||||||
GPDEBUG("Queue Overflow!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
numElement++;
|
|
||||||
|
|
||||||
event[rear].type = ev->type;
|
|
||||||
event[rear].button = ev->button;
|
|
||||||
rear = (rear + 1) % MAX_EVENTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isEmpty() {
|
|
||||||
return (numElement == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isFull() {
|
|
||||||
return (numElement == MAX_EVENTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get(GP32BtnEvent *ev) {
|
|
||||||
if (front == rear) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
numElement--;
|
|
||||||
ev->type = event[front].type;
|
|
||||||
ev->button = event[front].button;
|
|
||||||
front = (front + 1) % MAX_EVENTS;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EventQueue eventQueue;
|
|
||||||
|
|
||||||
bool gp_pumpButtonEvent() {
|
|
||||||
int nKey = gp_trapKey();
|
|
||||||
GP32BtnEvent ev;
|
|
||||||
|
|
||||||
const int keyBitMask[10] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
|
|
||||||
|
|
||||||
for (int i = 0; i < 10; i++) {
|
|
||||||
if (nKey & keyBitMask[i]) {
|
|
||||||
if (!GET_BUTTON_PRESSED(keyBitMask[i])) {
|
|
||||||
ON_BUTTON_PRESSED(keyBitMask[i]);
|
|
||||||
ev.type = BUTTON_DOWN;
|
|
||||||
ev.button = keyBitMask[i];
|
|
||||||
eventQueue.push(&ev);
|
|
||||||
//ON_BUTTON_DOWN(keyBitMask[i]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (GET_BUTTON_PRESSED(keyBitMask[i])) {
|
|
||||||
OFF_BUTTON_PRESSED(keyBitMask[i]);
|
|
||||||
ev.type = BUTTON_UP;
|
|
||||||
ev.button = keyBitMask[i];
|
|
||||||
eventQueue.push(&ev);
|
|
||||||
//ON_BUTTON_UP(keyBitMask[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gp_pollButtonEvent(GP32BtnEvent *ev) {
|
|
||||||
gp_pumpButtonEvent();
|
|
||||||
|
|
||||||
if (eventQueue.isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
eventQueue.get(ev);
|
|
||||||
// GPDEBUG("Event poll %d %d", ev->type, ev->button);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gp_getButtonPressed(uint16 button)
|
|
||||||
{
|
|
||||||
return buttonPressState & button;
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GP32STD_INPUT_H
|
|
||||||
#define __GP32STD_INPUT_H
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
|
|
||||||
#define BUTTON_DOWN 1
|
|
||||||
#define BUTTON_UP 2
|
|
||||||
|
|
||||||
struct GP32BtnEvent {
|
|
||||||
uint16 type;
|
|
||||||
uint16 button;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern int gp_trapKey();
|
|
||||||
|
|
||||||
extern bool gp_getButtonEvent(uint32 *nKeyUD, uint16 *nKeyP);
|
|
||||||
|
|
||||||
#define gpd_getEventDown(a) (((a) >> 12) & 0x0fff)
|
|
||||||
#define gpd_getEventUp(a) ((a) & 0x0fff)
|
|
||||||
#define gpd_getEventPressed(a) ((a) & 0x0fff)
|
|
||||||
#define gpd_getButtonDown(a,button) ((a) & (button) << 12)
|
|
||||||
#define gpd_getButtonUp(a,button) ((a) & (button))
|
|
||||||
#define gpd_getButtonPressed(a,button) ((a) & (button))
|
|
||||||
|
|
||||||
extern bool gp_pollButtonEvent(GP32BtnEvent *ev);
|
|
||||||
extern bool gp_getButtonPressed(uint16 button);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,318 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
//#include "graphics/scaler.h"
|
|
||||||
#include "common/system.h"
|
|
||||||
|
|
||||||
#include "engines/engine.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_grap.h"
|
|
||||||
#include "gp32std_memory.h"
|
|
||||||
|
|
||||||
/////////////////////
|
|
||||||
//Memory management
|
|
||||||
|
|
||||||
#define USER_MEMORY_SIZE (256 * 1024)
|
|
||||||
#define USER_BLOCK_SIZE 24
|
|
||||||
#define NUM_BLOCK (USER_MEMORY_SIZE / USER_BLOCK_SIZE)
|
|
||||||
// use fixed block size for small allocations
|
|
||||||
// consumes about 128k for block array
|
|
||||||
// consumes 256k for user memory
|
|
||||||
|
|
||||||
class MemBlock {
|
|
||||||
protected:
|
|
||||||
static byte *userMem;
|
|
||||||
// static size_t allocSize;
|
|
||||||
// static MemBlock *head;
|
|
||||||
static int numBlock;
|
|
||||||
static int prevBlock;
|
|
||||||
|
|
||||||
// Linked list is slow for this task. :)
|
|
||||||
static MemBlock *block;
|
|
||||||
|
|
||||||
byte *blockData;
|
|
||||||
size_t size;
|
|
||||||
|
|
||||||
// MemBlock *next;
|
|
||||||
|
|
||||||
int used;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static void init();
|
|
||||||
static void deinit();
|
|
||||||
|
|
||||||
static void *addBlock(size_t size);
|
|
||||||
static void deleteBlock(void *dstBlock);
|
|
||||||
};
|
|
||||||
|
|
||||||
byte *MemBlock::userMem = NULL;
|
|
||||||
//MemBlock *MemBlock::head = NULL;
|
|
||||||
//size_t MemBlock::allocSize = 0;
|
|
||||||
int MemBlock::numBlock = 0;
|
|
||||||
int MemBlock::prevBlock = 0;
|
|
||||||
MemBlock *MemBlock::block = NULL;
|
|
||||||
|
|
||||||
void MemBlock::init()
|
|
||||||
{
|
|
||||||
userMem = (byte *)gm_malloc(USER_MEMORY_SIZE + USER_BLOCK_SIZE);
|
|
||||||
block = (MemBlock *)gm_malloc(NUM_BLOCK * sizeof(MemBlock));
|
|
||||||
|
|
||||||
if (!(userMem && block)) {
|
|
||||||
//error
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(userMem, 0, USER_MEMORY_SIZE + USER_BLOCK_SIZE);
|
|
||||||
memset(block, 0, NUM_BLOCK * sizeof(MemBlock));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemBlock::deinit()
|
|
||||||
{
|
|
||||||
if (!(userMem && block)) {
|
|
||||||
//error
|
|
||||||
}
|
|
||||||
gm_free(userMem);
|
|
||||||
gm_free(block);
|
|
||||||
userMem = NULL;
|
|
||||||
block = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *MemBlock::addBlock(size_t size)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
MemBlock *blk = &block[prevBlock];
|
|
||||||
|
|
||||||
// some optimizaion with loop
|
|
||||||
for (i = prevBlock; i < NUM_BLOCK; i++) {
|
|
||||||
if (!blk->used) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
blk++;
|
|
||||||
}
|
|
||||||
if (i == NUM_BLOCK) {
|
|
||||||
blk = &block[0];
|
|
||||||
for (i = 0; i < prevBlock; i++) {
|
|
||||||
if (!blk->used) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
blk++;
|
|
||||||
}
|
|
||||||
if (i == prevBlock) {
|
|
||||||
prevBlock = 0;
|
|
||||||
return gm_malloc(size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
byte *ptr = userMem + (i * USER_BLOCK_SIZE);
|
|
||||||
|
|
||||||
blk->size = size;
|
|
||||||
blk->blockData = ptr;
|
|
||||||
blk->used = 1;
|
|
||||||
|
|
||||||
prevBlock = i;
|
|
||||||
|
|
||||||
return (void *) ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemBlock::deleteBlock(void *dstBlock)
|
|
||||||
{
|
|
||||||
// Faster method
|
|
||||||
uint32 np = (uint32) dstBlock - (uint32) userMem;
|
|
||||||
|
|
||||||
if ((np / USER_BLOCK_SIZE) * USER_BLOCK_SIZE != np) {
|
|
||||||
gm_free(dstBlock);
|
|
||||||
// warning("wrong block! (%d / %d)", (np / USER_BLOCK_SIZE) * USER_BLOCK_SIZE, np);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int i = np / USER_BLOCK_SIZE;
|
|
||||||
if (i > NUM_BLOCK) {
|
|
||||||
gm_free(dstBlock);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
block[i].used = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
int i = 0;
|
|
||||||
for (i = 0; i < NUM_BLOCK; i++) {
|
|
||||||
if (block[i].blockData == dstBlock)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == NUM_BLOCK) {
|
|
||||||
gm_free(dstBlock); //fixme?
|
|
||||||
//warning("wrong block! %x", (uint32)block - (uint32)userMem);
|
|
||||||
} else {
|
|
||||||
GPDEBUG("deleteing block %d", i);
|
|
||||||
block[i].used = 0;
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// HACK not to include struct MemBlock
|
|
||||||
void memBlockInit()
|
|
||||||
{
|
|
||||||
MemBlock::init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void memBlockDeinit()
|
|
||||||
{
|
|
||||||
MemBlock::deinit();
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef memcpy
|
|
||||||
#undef memset
|
|
||||||
void *gp_memcpy(void *dst, const void *src, size_t count) {
|
|
||||||
return memcpy(dst, src, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *gp_memset(void *dst, int val, size_t count) {
|
|
||||||
return memset(dst, val, count);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MALLOC_MASK 0xAB800000
|
|
||||||
|
|
||||||
// WE HAVE TO ALIGN MEMORY ADDRESS ON THE ARM PROCESSOR!
|
|
||||||
#define ALIGNED_SIZE(size) ((size) + (4 - ((size) & 3)))
|
|
||||||
|
|
||||||
void *gp_malloc(size_t size) {
|
|
||||||
uint32 np;
|
|
||||||
uint32 *up;
|
|
||||||
|
|
||||||
// size + 8 bytes : stores block size
|
|
||||||
int allocSize = ALIGNED_SIZE(size) + sizeof(uint32) + sizeof(uint32);
|
|
||||||
if (allocSize <= USER_BLOCK_SIZE) {
|
|
||||||
np = (uint32) MemBlock::addBlock(allocSize);
|
|
||||||
} else {
|
|
||||||
np = (uint32) gm_malloc(allocSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (np) {
|
|
||||||
up = (uint32 *)np;
|
|
||||||
*up = ALIGNED_SIZE(size) | MALLOC_MASK; // mem size: up to 8mb
|
|
||||||
up = (uint32 *)(np + ALIGNED_SIZE(size) + sizeof(uint32));
|
|
||||||
*up = 0x1234; // catches oob acess
|
|
||||||
return (void *)(np + sizeof(uint32));
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_free(void *block) {
|
|
||||||
uint32 np;
|
|
||||||
uint32 *up;
|
|
||||||
|
|
||||||
if (!block) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
np = ((uint32) block) - sizeof(uint32);
|
|
||||||
up = (uint32 *) np;
|
|
||||||
if (*up == 0x4321) {
|
|
||||||
warning("%s: double deallocation", __FUNCTION__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*up & MALLOC_MASK != MALLOC_MASK) {
|
|
||||||
warning("%s: corrupt block", __FUNCTION__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int blockSize = (*up & 0x7fffff);
|
|
||||||
up = (uint32 *)(np + blockSize + sizeof(uint32));
|
|
||||||
if (*up != 0x1234) {
|
|
||||||
warning("gp_free: corrupt block - OOB access", __FUNCTION__);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
np = ((uint32) block) - sizeof(uint32);
|
|
||||||
up = (uint32 *) np;
|
|
||||||
*up = 0x4321;
|
|
||||||
|
|
||||||
if (blockSize + 8 <= USER_BLOCK_SIZE) {
|
|
||||||
MemBlock::deleteBlock(up);
|
|
||||||
} else {
|
|
||||||
gm_free(up);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void *gp_calloc(size_t nitems, size_t size) {
|
|
||||||
void *p = gp_malloc(nitems * size); //gpcalloc doesnt clear?
|
|
||||||
|
|
||||||
gp_memset(p, 0, nitems * size);
|
|
||||||
|
|
||||||
// if (*(uint8 *)p != 0)
|
|
||||||
// warning("%s: calloc doesn't clear", __FUNCTION__); //fixme: was error
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
// GP32 stuff
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
static char usedMemStr[16];
|
|
||||||
int gUsedMem = 1024 * 1024;
|
|
||||||
|
|
||||||
//#define CLEAN_MEMORY_WITH_0xE7
|
|
||||||
//#define CHECK_USED_MEMORY
|
|
||||||
//#define CHECK_NEW_TIME
|
|
||||||
//#define CHECK_NEW_SIZE
|
|
||||||
|
|
||||||
void *operator new(size_t size) {
|
|
||||||
#if defined(CHECK_NEW_TIME)
|
|
||||||
static int ftick;
|
|
||||||
ftick = GpTickCountGet();
|
|
||||||
#endif
|
|
||||||
// printf("BP:operator new(%d)", size);
|
|
||||||
void *ptr = gp_malloc(size);
|
|
||||||
|
|
||||||
#if defined(CLEAN_MEMORY_WITH_0xE7)
|
|
||||||
if (ptr != NULL) {
|
|
||||||
gp_memset(ptr, 0xE7, size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined(CHECK_USED_MEMORY)
|
|
||||||
// Check free memory.
|
|
||||||
gUsedMem = ((int)(ptr) + size) - 0xc000000;
|
|
||||||
|
|
||||||
sprintf(usedMemStr, "%8d", gUsedMem);
|
|
||||||
gp_fillRect(frameBuffer1, 0, 0, 64, 12, 0);
|
|
||||||
gp_textOut(frameBuffer1, 0, 0, usedMemStr, 0xfffff);
|
|
||||||
#endif
|
|
||||||
#if defined(CHECK_NEW_TIME)
|
|
||||||
sprintf(usedMemStr, "%2d", GpTickCountGet() - ftick);
|
|
||||||
gp_fillRect(frameBuffer1, 72, 0, 24, 12, 0);
|
|
||||||
gp_textOut(frameBuffer1, 72, 0, usedMemStr, 0xfffff);
|
|
||||||
#endif
|
|
||||||
#if defined(CHECK_NEW_SIZE)
|
|
||||||
sprintf(usedMemStr, "%8d", size);
|
|
||||||
gp_fillRect(frameBuffer1, 108, 0, 64, 12, 0);
|
|
||||||
gp_textOut(frameBuffer1, 108, 0, usedMemStr, 0xfffff);
|
|
||||||
#endif
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete(void *ptr) {
|
|
||||||
// printf("operator delete(%x)", ptr);
|
|
||||||
gp_free(ptr);
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GP32STD_MEMORY_H
|
|
||||||
#define __GP32STD_MEMORY_H
|
|
||||||
|
|
||||||
extern void * gp_memcpy(void *dst, const void *src, size_t count);
|
|
||||||
extern void * gp_memset(void *dst, int val, size_t count);
|
|
||||||
extern void * gp_malloc(size_t size);
|
|
||||||
extern void * gp_calloc(size_t nitems, size_t size);
|
|
||||||
extern void gp_free(void *block);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,187 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
|
||||||
|
|
||||||
#include "gp32std.h"
|
|
||||||
#include "gp32std_sound.h"
|
|
||||||
|
|
||||||
#define GP32_TIMER_AUDIO_IDX 0
|
|
||||||
|
|
||||||
// Global variables
|
|
||||||
static volatile unsigned int frame = 0;
|
|
||||||
static volatile unsigned int *soundPos = 0;
|
|
||||||
static volatile int idx_buf;
|
|
||||||
static volatile unsigned int shiftVal = 0;
|
|
||||||
static void *buffer;
|
|
||||||
static GPSOUNDBUF soundBuf;
|
|
||||||
|
|
||||||
// This routine gets called by the timer interrupt and
|
|
||||||
// polls the current playing position within the buffer.
|
|
||||||
|
|
||||||
static void soundTimer() {
|
|
||||||
static int locked = false;
|
|
||||||
|
|
||||||
if (locked) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
locked = true;
|
|
||||||
|
|
||||||
unsigned int sampleshiftVal = soundBuf.samples << shiftVal;
|
|
||||||
unsigned int t = (((unsigned int)(*soundPos) - (unsigned int)buffer) >> shiftVal) >= soundBuf.samples ? 1 : 0;
|
|
||||||
if (t != frame) {
|
|
||||||
unsigned int offs = ((frame == 1) ? (sampleshiftVal) : 0);
|
|
||||||
//memset((uint8 *)buffer + offs, 0, sampleshiftVal);
|
|
||||||
soundBuf.callback(soundBuf.userdata, (uint8 *)((unsigned int)buffer + offs), sampleshiftVal);
|
|
||||||
frame = t;
|
|
||||||
{
|
|
||||||
// Play silence
|
|
||||||
register uint16 *d = (uint16 *)((uint8 *)buffer + offs); // alignment-safe
|
|
||||||
register uint32 max = (uint32)((uint8 *)buffer + offs + sampleshiftVal);
|
|
||||||
do {
|
|
||||||
*d++ ^= 0x8000; // 1
|
|
||||||
*d++ ^= 0x8000; // 2
|
|
||||||
*d++ ^= 0x8000; // 3
|
|
||||||
*d++ ^= 0x8000; // 4
|
|
||||||
*d++ ^= 0x8000; // 5
|
|
||||||
*d++ ^= 0x8000; // 6
|
|
||||||
*d++ ^= 0x8000; // 7
|
|
||||||
*d++ ^= 0x8000; // 8
|
|
||||||
*d++ ^= 0x8000; // 9
|
|
||||||
*d++ ^= 0x8000; // 10
|
|
||||||
*d++ ^= 0x8000; // 11
|
|
||||||
*d++ ^= 0x8000; // 12
|
|
||||||
*d++ ^= 0x8000; // 13
|
|
||||||
*d++ ^= 0x8000; // 14
|
|
||||||
*d++ ^= 0x8000; // 15
|
|
||||||
*d++ ^= 0x8000; // 16
|
|
||||||
*d++ ^= 0x8000; // 17
|
|
||||||
*d++ ^= 0x8000; // 18
|
|
||||||
*d++ ^= 0x8000; // 19
|
|
||||||
*d++ ^= 0x8000; // 20
|
|
||||||
*d++ ^= 0x8000; // 21
|
|
||||||
*d++ ^= 0x8000; // 22
|
|
||||||
*d++ ^= 0x8000; // 23
|
|
||||||
*d++ ^= 0x8000; // 24
|
|
||||||
*d++ ^= 0x8000; // 25
|
|
||||||
*d++ ^= 0x8000; // 26
|
|
||||||
*d++ ^= 0x8000; // 27
|
|
||||||
*d++ ^= 0x8000; // 28
|
|
||||||
*d++ ^= 0x8000; // 29
|
|
||||||
*d++ ^= 0x8000; // 30
|
|
||||||
*d++ ^= 0x8000; // 31
|
|
||||||
*d++ ^= 0x8000; // 32
|
|
||||||
} while ((uint32)d < max);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
locked = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gp_soundBufStart(GPSOUNDBUF *sb) {
|
|
||||||
int bufferSize = 0;
|
|
||||||
|
|
||||||
PCM_SR gpFreq = PCM_S11;
|
|
||||||
PCM_BIT gpFormat = PCM_16BIT;
|
|
||||||
|
|
||||||
frame = 0;
|
|
||||||
|
|
||||||
// Copy the structure
|
|
||||||
memcpy(&soundBuf, sb, sizeof(GPSOUNDBUF));
|
|
||||||
|
|
||||||
// Calculate size of a single sample in bytes
|
|
||||||
// and a corresponding shift value
|
|
||||||
shiftVal = 0;
|
|
||||||
|
|
||||||
switch (soundBuf.format) {
|
|
||||||
case 8:
|
|
||||||
gpFormat = PCM_8BIT;
|
|
||||||
break;
|
|
||||||
case 16:
|
|
||||||
gpFormat = PCM_16BIT;
|
|
||||||
shiftVal++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (soundBuf.freq) {
|
|
||||||
case 11025:
|
|
||||||
if (soundBuf.channels == 2) {
|
|
||||||
gpFreq = PCM_S11;
|
|
||||||
shiftVal++;
|
|
||||||
} else
|
|
||||||
gpFreq = PCM_M11;
|
|
||||||
break;
|
|
||||||
case 22050:
|
|
||||||
if (soundBuf.channels == 2) {
|
|
||||||
gpFreq = PCM_S22;
|
|
||||||
shiftVal++;
|
|
||||||
} else
|
|
||||||
gpFreq = PCM_M22;
|
|
||||||
break;
|
|
||||||
case 44100:
|
|
||||||
if (soundBuf.channels == 2) {
|
|
||||||
gpFreq = PCM_S44;
|
|
||||||
shiftVal++;
|
|
||||||
} else
|
|
||||||
gpFreq = PCM_M44;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
soundBuf.samplesize = 1 << shiftVal;
|
|
||||||
|
|
||||||
// Allocate memory for the playing buffer
|
|
||||||
bufferSize = soundBuf.samplesize * soundBuf.samples * 2;
|
|
||||||
buffer = malloc(bufferSize);
|
|
||||||
|
|
||||||
// Clear the buffer
|
|
||||||
uint16 *tmpBuf = (uint16 *)buffer;
|
|
||||||
for (int i = 0; i < bufferSize / 2; i++)
|
|
||||||
tmpBuf[i] = 0x8000;
|
|
||||||
|
|
||||||
// Frequency of the timer interrupt which polls the playing position
|
|
||||||
// FIXME: This frequency should not be multiplied by 4.
|
|
||||||
soundBuf.pollfreq = 4 * (2 * soundBuf.freq) / soundBuf.samples;
|
|
||||||
|
|
||||||
// Set timer interrupt
|
|
||||||
if (GpTimerOptSet(GP32_TIMER_AUDIO_IDX, soundBuf.pollfreq, 0, soundTimer) == GPOS_ERR_ALREADY_USED) {
|
|
||||||
GPDEBUG(" Timer is already used... kill timer");
|
|
||||||
GpTimerKill(GP32_TIMER_AUDIO_IDX);
|
|
||||||
}
|
|
||||||
GpTimerSet(GP32_TIMER_AUDIO_IDX);
|
|
||||||
|
|
||||||
GpPcmInit(gpFreq, gpFormat);
|
|
||||||
GpPcmPlay((unsigned short *)buffer, bufferSize, 1);
|
|
||||||
GpPcmLock((unsigned short *)buffer, (int *)&idx_buf, (unsigned int *)&soundPos);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void gp_soundBufStop() {
|
|
||||||
GpTimerKill(GP32_TIMER_AUDIO_IDX);
|
|
||||||
GpPcmStop();
|
|
||||||
GpPcmRemove((unsigned short *)buffer);
|
|
||||||
free(buffer);
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
* $URL$
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GP32STD_SOUND_H
|
|
||||||
#define __GP32STD_SOUND_H
|
|
||||||
|
|
||||||
// GPSOUNDBUF.userdata / Pointer to the buffer which needs to be refilled / Length of the buffer in bytes
|
|
||||||
typedef void SoundProc(void *param, byte *buf, int len);
|
|
||||||
|
|
||||||
typedef struct TGPSOUNDBUF {
|
|
||||||
int32 freq;
|
|
||||||
uint16 format;
|
|
||||||
uint16 samples; // Buffer length (in samples)
|
|
||||||
uint16 channels;
|
|
||||||
uint16 padding; // Fix alignment problem
|
|
||||||
void *userdata; // Userdata which gets passed to the callback function
|
|
||||||
SoundProc *callback; // Callback function (just like in SDL)
|
|
||||||
unsigned int pollfreq; // Frequency of the timer interrupt which polls the playing position
|
|
||||||
// recommended value: 2*(playingfreq in Hz/GPSOUNDBUF.samples)
|
|
||||||
unsigned int samplesize; // Size of one sample (8bit mono->1, 16bit stereo->4) - don't touch this
|
|
||||||
} GPSOUNDBUF;
|
|
||||||
|
|
||||||
int gp_soundBufStart(GPSOUNDBUF *sb);
|
|
||||||
void gp_soundBufStop();
|
|
||||||
|
|
||||||
#endif
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue