Removed trailing spaces.
svn-id: r30664
This commit is contained in:
parent
278857698d
commit
66e9d4f5e8
530 changed files with 6448 additions and 6448 deletions
2
Makefile
2
Makefile
|
@ -21,7 +21,7 @@ MODULE_DIRS :=
|
||||||
|
|
||||||
CXXFLAGS:= -Wall $(CXXFLAGS)
|
CXXFLAGS:= -Wall $(CXXFLAGS)
|
||||||
# Turn off some annoying and not-so-useful warnings
|
# Turn off some annoying and not-so-useful warnings
|
||||||
CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
|
CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas -Wno-reorder
|
||||||
# Enable even more warnings...
|
# Enable even more warnings...
|
||||||
CXXFLAGS+= -pedantic -Wpointer-arith -Wcast-qual -Wconversion
|
CXXFLAGS+= -pedantic -Wpointer-arith -Wcast-qual -Wconversion
|
||||||
CXXFLAGS+= -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor -Wwrite-strings
|
CXXFLAGS+= -Wshadow -Wimplicit -Wundef -Wnon-virtual-dtor -Wwrite-strings
|
||||||
|
|
|
@ -52,7 +52,7 @@ CPPFLAGS := $(DEFINES) $(INCLUDES)
|
||||||
|
|
||||||
# Depdir information
|
# Depdir information
|
||||||
DEPDIRS = $(addsuffix $(DEPDIR),$(MODULE_DIRS))
|
DEPDIRS = $(addsuffix $(DEPDIR),$(MODULE_DIRS))
|
||||||
DEPFILES =
|
DEPFILES =
|
||||||
|
|
||||||
# Make base/version.o depend on all other object files. This way if anything is
|
# Make base/version.o depend on all other object files. This way if anything is
|
||||||
# changed, it causes version.cpp to be recompiled. This in turn ensures that
|
# changed, it causes version.cpp to be recompiled. This in turn ensures that
|
||||||
|
@ -78,7 +78,7 @@ clean:
|
||||||
|
|
||||||
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.
|
||||||
%.o: %.cpp
|
%.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
|
||||||
|
|
32
NEWS
32
NEWS
|
@ -20,7 +20,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
New Ports:
|
New Ports:
|
||||||
- Added iPhone port.
|
- Added iPhone port.
|
||||||
- Added Maemo port for Nokia Internet tablets.
|
- Added Maemo port for Nokia Internet tablets.
|
||||||
|
|
||||||
General:
|
General:
|
||||||
- Added ARM assembly routines for code in the sound mixer and SCUMM
|
- Added ARM assembly routines for code in the sound mixer and SCUMM
|
||||||
video playback, resulting in some nice speedups on several ports.
|
video playback, resulting in some nice speedups on several ports.
|
||||||
|
@ -157,7 +157,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
- Improved performance for S60v3 and UIQ3 using ARM target.
|
- Improved performance for S60v3 and UIQ3 using ARM target.
|
||||||
- Limited support for pre Symbian OS9 devices due to compiler issues.
|
- Limited support for pre Symbian OS9 devices due to compiler issues.
|
||||||
- Updated key mapping handling.
|
- Updated key mapping handling.
|
||||||
|
|
||||||
WinCE Port:
|
WinCE Port:
|
||||||
- Switched to using a GCC toolchain for building.
|
- Switched to using a GCC toolchain for building.
|
||||||
- Major update to the SDL lib. Better, faster, more compatible :-)
|
- Major update to the SDL lib. Better, faster, more compatible :-)
|
||||||
|
@ -274,13 +274,13 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
- Missing data files are handled more gracefully.
|
- Missing data files are handled more gracefully.
|
||||||
|
|
||||||
WinCE Port:
|
WinCE Port:
|
||||||
- Added: PocketPC: Vertical oversampling scaler 320x200=>320x240 when panel not shown (n0p)
|
- Added: PocketPC: Vertical oversampling scaler 320x200=>320x240 when panel not shown (n0p)
|
||||||
- Added: PocketPC: Right click by double-tapping (n0p)
|
- Added: PocketPC: Right click by double-tapping (n0p)
|
||||||
- Fixed: All: Clipping issues in some cases
|
- Fixed: All: Clipping issues in some cases
|
||||||
- Added: PocketPC: Mouse emulation using keys
|
- Added: PocketPC: Mouse emulation using keys
|
||||||
- Added: Smartphones: Virtual keyboard popup
|
- Added: Smartphones: Virtual keyboard popup
|
||||||
- Fixed: Smartphones: Incorrect screen blit in SDL port
|
- Fixed: Smartphones: Incorrect screen blit in SDL port
|
||||||
- Added: All: Mouse cursor visible on panel if using emulated mouse
|
- Added: All: Mouse cursor visible on panel if using emulated mouse
|
||||||
- Added: All: Inverse landscape mode
|
- Added: All: Inverse landscape mode
|
||||||
- Fixed: PocketPC: Dialogs cut-off/not redrawn
|
- Fixed: PocketPC: Dialogs cut-off/not redrawn
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
- Should fix weird crashes with DOTT stamp and in FOA (#1399830 #1392815)
|
- Should fix weird crashes with DOTT stamp and in FOA (#1399830 #1392815)
|
||||||
- Fixed Monkey Island blocking keyboard panel on Smartphones (thks Knakos)
|
- Fixed Monkey Island blocking keyboard panel on Smartphones (thks Knakos)
|
||||||
- Fixed QVGA Smartphone detection (mean it this time :p)
|
- Fixed QVGA Smartphone detection (mean it this time :p)
|
||||||
- Fixed Smartphone double right click issue.
|
- Fixed Smartphone double right click issue.
|
||||||
|
|
||||||
0.8.1 (2006-01-31)
|
0.8.1 (2006-01-31)
|
||||||
General:
|
General:
|
||||||
|
@ -437,12 +437,12 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
|
|
||||||
SCUMM:
|
SCUMM:
|
||||||
- Fixed wrong actor animation in Full Throttle INSANE
|
- Fixed wrong actor animation in Full Throttle INSANE
|
||||||
|
|
||||||
Windows Mobile port (PocketPC / Smartphone) :
|
Windows Mobile port (PocketPC / Smartphone) :
|
||||||
- Fixed FOTAQ crash on all platforms when leaving the hotel AGAIN
|
- Fixed FOTAQ crash on all platforms when leaving the hotel AGAIN
|
||||||
- Better low quality Adlib emulation for FOTAQ
|
- Better low quality Adlib emulation for FOTAQ
|
||||||
- Fix randomly broken Hide Toolbar option (thanks iKi)
|
- Fix randomly broken Hide Toolbar option (thanks iKi)
|
||||||
- Fix first hardware key mapping (was not displayed before)
|
- Fix first hardware key mapping (was not displayed before)
|
||||||
- Fix BASS & Simon hangs on Smartphone when using the Skip hotkey
|
- Fix BASS & Simon hangs on Smartphone when using the Skip hotkey
|
||||||
- Fix Zone key action on Smartphone (now mapped on key 9)
|
- Fix Zone key action on Smartphone (now mapped on key 9)
|
||||||
- Experimental third party VGA mode (SE-VGA) fix
|
- Experimental third party VGA mode (SE-VGA) fix
|
||||||
|
@ -494,7 +494,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
file. This removes the need for using the 'RESCUMM' program
|
file. This removes the need for using the 'RESCUMM' program
|
||||||
- Added smooth horizontal scrolling for The Dig, Full Throttle and COMI
|
- Added smooth horizontal scrolling for The Dig, Full Throttle and COMI
|
||||||
(matching the original engine)
|
(matching the original engine)
|
||||||
- Partially rewrote the text engine, fixing various bugs, especially in
|
- Partially rewrote the text engine, fixing various bugs, especially in
|
||||||
newer games (The Dig, COMI)
|
newer games (The Dig, COMI)
|
||||||
- Fixed actor drawing glitches in V1 Maniac and Zak
|
- Fixed actor drawing glitches in V1 Maniac and Zak
|
||||||
- Fixed ship-to-ship graphic glitches in COMI
|
- Fixed ship-to-ship graphic glitches in COMI
|
||||||
|
@ -521,7 +521,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
|
|
||||||
0.6.1b (2004-08-03)
|
0.6.1b (2004-08-03)
|
||||||
General:
|
General:
|
||||||
- Fixed copy/paste bug in launcher that may corrupt the Savegame Path
|
- Fixed copy/paste bug in launcher that may corrupt the Savegame Path
|
||||||
- Fixed crashes on 64-bit architectures
|
- Fixed crashes on 64-bit architectures
|
||||||
|
|
||||||
SCUMM:
|
SCUMM:
|
||||||
|
@ -602,7 +602,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
- Keyboard support for cannon battle in Curse of Monkey Island
|
- Keyboard support for cannon battle in Curse of Monkey Island
|
||||||
- Keyboard support for derby scene in Full Throttle
|
- Keyboard support for derby scene in Full Throttle
|
||||||
|
|
||||||
0.5.1 (2003-08-06)
|
0.5.1 (2003-08-06)
|
||||||
- Rewrote Beneath a Steel Sky savegame code (see note in READMEs 'Known Bugs')
|
- Rewrote Beneath a Steel Sky savegame code (see note in READMEs 'Known Bugs')
|
||||||
- Fixed dialog skipping, music volume and several crashes/freezes in Steel Sky
|
- Fixed dialog skipping, music volume and several crashes/freezes in Steel Sky
|
||||||
- Fixed dialog skipping in V7 games
|
- Fixed dialog skipping in V7 games
|
||||||
|
@ -644,7 +644,7 @@ For a more comprehensive changelog for the latest experimental SVN code, see:
|
||||||
- Added support for the EGA versions of Loom, Monkey Island and Indy3
|
- Added support for the EGA versions of Loom, Monkey Island and Indy3
|
||||||
- Improved music support in Indy3 and the floppy versions of Monkey Island
|
- Improved music support in Indy3 and the floppy versions of Monkey Island
|
||||||
- Many Simon the Sorcerer 1 & 2 improvements and fixes
|
- Many Simon the Sorcerer 1 & 2 improvements and fixes
|
||||||
- Very pre-alpha Beneath a Steel Sky code. Don't expect it to do anything.
|
- Very pre-alpha Beneath a Steel Sky code. Don't expect it to do anything.
|
||||||
- Even more pre-alpha support for V2 SCUMM games (Maniac Mansion and Zak)
|
- Even more pre-alpha support for V2 SCUMM games (Maniac Mansion and Zak)
|
||||||
- Preliminary support for early Humongous Entertainment titles (very
|
- Preliminary support for early Humongous Entertainment titles (very
|
||||||
experimental)
|
experimental)
|
||||||
|
|
12
README
12
README
|
@ -149,12 +149,12 @@ AGI Games by Sierra:
|
||||||
King's Quest II [kq2]
|
King's Quest II [kq2]
|
||||||
King's Quest III [kq3]
|
King's Quest III [kq3]
|
||||||
King's Quest IV [kq4]
|
King's Quest IV [kq4]
|
||||||
Leisure Suit Larry in the Land of the
|
Leisure Suit Larry in the Land of the
|
||||||
Lounge Lizards [lsl1]
|
Lounge Lizards [lsl1]
|
||||||
Mixed-Up Mother Goose [mixedup]
|
Mixed-Up Mother Goose [mixedup]
|
||||||
Manhunter 1: New York [mh1]
|
Manhunter 1: New York [mh1]
|
||||||
Manhunter 2: San Francisco [mh2]
|
Manhunter 2: San Francisco [mh2]
|
||||||
Police Quest I: In Pursuit of the Death
|
Police Quest I: In Pursuit of the Death
|
||||||
Angel [pq1]
|
Angel [pq1]
|
||||||
Space Quest I: The Sarien Encounter [sq1]
|
Space Quest I: The Sarien Encounter [sq1]
|
||||||
Space Quest II: Vohaul's Revenge [sq2]
|
Space Quest II: Vohaul's Revenge [sq2]
|
||||||
|
@ -401,7 +401,7 @@ FLAC and zlib support.
|
||||||
For systems that are too slow to handle the decoding of FLAC audio,
|
For systems that are too slow to handle the decoding of FLAC audio,
|
||||||
the audio for these cutscenes is also provided separately as OGG Vorbis audio.
|
the audio for these cutscenes is also provided separately as OGG Vorbis audio.
|
||||||
Viewing these cutscenes with OGG Vorbis audio requires a version of ScummVM
|
Viewing these cutscenes with OGG Vorbis audio requires a version of ScummVM
|
||||||
compiled with both libVorbis and zlib support.
|
compiled with both libVorbis and zlib support.
|
||||||
|
|
||||||
The cutscenes should be placed in the main game data directory. Note that
|
The cutscenes should be placed in the main game data directory. Note that
|
||||||
currently this requires either copying the game to hard disk or burning
|
currently this requires either copying the game to hard disk or burning
|
||||||
|
@ -512,7 +512,7 @@ to note.
|
||||||
|
|
||||||
Many of the files necessary for the game are stored in an InstallShield file
|
Many of the files necessary for the game are stored in an InstallShield file
|
||||||
called data1.cab, which ScummVM is unable to unpack. You will need to use the
|
called data1.cab, which ScummVM is unable to unpack. You will need to use the
|
||||||
original installer or i5comp to unpack the contents of this file. The i5comp
|
original installer or i5comp to unpack the contents of this file. The i5comp
|
||||||
decompression tool, can be found via a search on the internet.
|
decompression tool, can be found via a search on the internet.
|
||||||
|
|
||||||
The game uses Smacker cutscenes extensively, which we can't support directly,
|
The game uses Smacker cutscenes extensively, which we can't support directly,
|
||||||
|
@ -565,7 +565,7 @@ more than one words share the same numeric representation. For example the
|
||||||
words 'quit' and 'suit' map to the same number, namely 7848. In these cases the
|
words 'quit' and 'suit' map to the same number, namely 7848. In these cases the
|
||||||
(#)next button lights up. By pressing it, you can cycle through the list of
|
(#)next button lights up. By pressing it, you can cycle through the list of
|
||||||
words sharing the same code and finally accept the correct one by pressing
|
words sharing the same code and finally accept the correct one by pressing
|
||||||
(0)space or the Ok button.
|
(0)space or the Ok button.
|
||||||
|
|
||||||
The second input method (123) is the numeric input: Each key you press is
|
The second input method (123) is the numeric input: Each key you press is
|
||||||
entered verbatim as a number.
|
entered verbatim as a number.
|
||||||
|
@ -1788,7 +1788,7 @@ messages (see http://www.sysinternals.com/ntw2k/freeware/debugview.shtml).
|
||||||
* run 'make config'
|
* run 'make config'
|
||||||
* run 'make scummvm'
|
* run 'make scummvm'
|
||||||
* create your debian/changelog in top directory
|
* create your debian/changelog in top directory
|
||||||
* run 'make deb' in backends/platform/maemo
|
* run 'make deb' in backends/platform/maemo
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Good Luck and Happy Adventuring!
|
Good Luck and Happy Adventuring!
|
||||||
|
|
|
@ -60,7 +60,7 @@ void readRecord(Common::InSaveFile *inFile, uint32 &diff, Common::Event &event)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeRecord(Common::OutSaveFile *outFile, uint32 diff, Common::Event &event) {
|
void writeRecord(Common::OutSaveFile *outFile, uint32 diff, Common::Event &event) {
|
||||||
|
@ -174,7 +174,7 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) :
|
||||||
|
|
||||||
// conf vars
|
// conf vars
|
||||||
ConfMan.setBool("subtitles", _playbackFile->readByte() != 0);
|
ConfMan.setBool("subtitles", _playbackFile->readByte() != 0);
|
||||||
|
|
||||||
_recordCount = _playbackFile->readUint32LE();
|
_recordCount = _playbackFile->readUint32LE();
|
||||||
_recordTimeCount = _playbackFile->readUint32LE();
|
_recordTimeCount = _playbackFile->readUint32LE();
|
||||||
randomSourceCount = _playbackFile->readUint32LE();
|
randomSourceCount = _playbackFile->readUint32LE();
|
||||||
|
@ -274,7 +274,7 @@ bool DefaultEventManager::playback(Common::Event &event) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event = _playbackEvent;
|
event = _playbackEvent;
|
||||||
_hasPlaybackEvent = false;
|
_hasPlaybackEvent = false;
|
||||||
_lastEventCount = _eventCount;
|
_lastEventCount = _eventCount;
|
||||||
|
@ -361,7 +361,7 @@ bool DefaultEventManager::pollEvent(Common::Event &event) {
|
||||||
if (event.type != Common::EVENT_QUIT) {
|
if (event.type != Common::EVENT_QUIT) {
|
||||||
result = playback(event);
|
result = playback(event);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_recordMode == kRecorderRecord) {
|
if (_recordMode == kRecorderRecord) {
|
||||||
if (result) {
|
if (result) {
|
||||||
record(event);
|
record(event);
|
||||||
|
|
|
@ -48,13 +48,13 @@ class DefaultEventManager : public Common::EventManager {
|
||||||
int _buttonState;
|
int _buttonState;
|
||||||
int _modifierState;
|
int _modifierState;
|
||||||
bool _shouldQuit;
|
bool _shouldQuit;
|
||||||
|
|
||||||
class RandomSourceRecord {
|
class RandomSourceRecord {
|
||||||
public:
|
public:
|
||||||
Common::String name;
|
Common::String name;
|
||||||
uint32 seed;
|
uint32 seed;
|
||||||
};
|
};
|
||||||
Common::Array<RandomSourceRecord> _randomSourceRecords;
|
Common::Array<RandomSourceRecord> _randomSourceRecords;
|
||||||
|
|
||||||
bool _recordSubtitles;
|
bool _recordSubtitles;
|
||||||
volatile uint32 _recordCount;
|
volatile uint32 _recordCount;
|
||||||
|
@ -70,7 +70,7 @@ class DefaultEventManager : public Common::EventManager {
|
||||||
volatile uint32 _playbackDiff;
|
volatile uint32 _playbackDiff;
|
||||||
volatile bool _hasPlaybackEvent;
|
volatile bool _hasPlaybackEvent;
|
||||||
volatile uint32 _playbackTimeCount;
|
volatile uint32 _playbackTimeCount;
|
||||||
Common::Event _playbackEvent;
|
Common::Event _playbackEvent;
|
||||||
Common::InSaveFile *_playbackFile;
|
Common::InSaveFile *_playbackFile;
|
||||||
Common::InSaveFile *_playbackTimeFile;
|
Common::InSaveFile *_playbackTimeFile;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class DefaultEventManager : public Common::EventManager {
|
||||||
Common::String _recordFileName;
|
Common::String _recordFileName;
|
||||||
Common::String _recordTempFileName;
|
Common::String _recordTempFileName;
|
||||||
Common::String _recordTimeFileName;
|
Common::String _recordTimeFileName;
|
||||||
|
|
||||||
// for continuous events (keyDown)
|
// for continuous events (keyDown)
|
||||||
enum {
|
enum {
|
||||||
kKeyRepeatInitialDelay = 400,
|
kKeyRepeatInitialDelay = 400,
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
/*
|
/*
|
||||||
* All the following includes choose, at compile time, which specific backend will be used
|
* All the following includes choose, at compile time, which specific backend will be used
|
||||||
* during the execution of the ScummVM.
|
* during the execution of the ScummVM.
|
||||||
*
|
*
|
||||||
* It has to be done this way because not all the necessary libraries will be available in
|
* It has to be done this way because not all the necessary libraries will be available in
|
||||||
* all build environments. Additionally, this results in smaller binaries.
|
* all build environments. Additionally, this results in smaller binaries.
|
||||||
*/
|
*/
|
||||||
|
@ -57,8 +57,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates concrete FilesystemFactory objects depending on the current architecture.
|
* Creates concrete FilesystemFactory objects depending on the current architecture.
|
||||||
*
|
*
|
||||||
* @return AbstractFilesystemFactory* The specific factory for the current architecture.
|
* @return AbstractFilesystemFactory* The specific factory for the current architecture.
|
||||||
*/
|
*/
|
||||||
AbstractFilesystemFactory *AbstractFilesystemFactory::makeFSFactory() {
|
AbstractFilesystemFactory *AbstractFilesystemFactory::makeFSFactory() {
|
||||||
#if defined(__amigaos4__)
|
#if defined(__amigaos4__)
|
||||||
|
|
|
@ -46,7 +46,7 @@ protected:
|
||||||
friend class FilesystemNode;
|
friend class FilesystemNode;
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
typedef FilesystemNode::ListMode ListMode;
|
typedef FilesystemNode::ListMode ListMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the child node with the given name. If no child with this name
|
* Returns the child node with the given name. If no child with this name
|
||||||
* exists, returns 0. When called on a non-directory node, it should
|
* exists, returns 0. When called on a non-directory node, it should
|
||||||
|
@ -55,13 +55,13 @@ protected:
|
||||||
* Example:
|
* Example:
|
||||||
* Calling getChild() for a node with path "/foo/bar" using name="file.txt",
|
* Calling getChild() for a node with path "/foo/bar" using name="file.txt",
|
||||||
* would produce a new node with "/foo/bar/file.txt" as path.
|
* would produce a new node with "/foo/bar/file.txt" as path.
|
||||||
*
|
*
|
||||||
* @note This function will append a separator char (\ or /) to the end of the
|
* @note This function will append a separator char (\ or /) to the end of the
|
||||||
* path if needed.
|
* path if needed.
|
||||||
*
|
*
|
||||||
* @note Handling calls on non-dir nodes gracefully makes it possible to
|
* @note Handling calls on non-dir nodes gracefully makes it possible to
|
||||||
* switch to a lazy type detection scheme in the future.
|
* switch to a lazy type detection scheme in the future.
|
||||||
*
|
*
|
||||||
* @param name String containing the name of the child to create a new node.
|
* @param name String containing the name of the child to create a new node.
|
||||||
*/
|
*/
|
||||||
virtual AbstractFilesystemNode *getChild(const String &name) const = 0;
|
virtual AbstractFilesystemNode *getChild(const String &name) const = 0;
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~AbstractFilesystemNode() {}
|
virtual ~AbstractFilesystemNode() {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Indicates whether the object referred by this path exists in the filesystem or not.
|
* Indicates whether the object referred by this path exists in the filesystem or not.
|
||||||
*/
|
*/
|
||||||
|
@ -86,65 +86,65 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return a list of child nodes of this directory node. If called on a node
|
* Return a list of child nodes of this directory node. If called on a node
|
||||||
* that does not represent a directory, false is returned.
|
* that does not represent a directory, false is returned.
|
||||||
*
|
*
|
||||||
* @param list List to put the contents of the directory in.
|
* @param list List to put the contents of the directory in.
|
||||||
* @param mode Mode to use while listing the directory.
|
* @param mode Mode to use while listing the directory.
|
||||||
* @param hidden Whether to include hidden files or not in the results.
|
* @param hidden Whether to include hidden files or not in the results.
|
||||||
*
|
*
|
||||||
* @return true if succesful, false otherwise (e.g. when the directory does not exist).
|
* @return true if succesful, false otherwise (e.g. when the directory does not exist).
|
||||||
*/
|
*/
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const = 0;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a human readable path string.
|
* Returns a human readable path string.
|
||||||
*
|
*
|
||||||
* @note By default, this method returns the value of getName().
|
* @note By default, this method returns the value of getName().
|
||||||
*/
|
*/
|
||||||
virtual String getDisplayName() const { return getName(); }
|
virtual String getDisplayName() const { return getName(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of the path pointed by this FilesystemNode.
|
* Returns the last component of the path pointed by this FilesystemNode.
|
||||||
*
|
*
|
||||||
* Examples (POSIX):
|
* Examples (POSIX):
|
||||||
* /foo/bar.txt would return /bar.txt
|
* /foo/bar.txt would return /bar.txt
|
||||||
* /foo/bar/ would return /bar/
|
* /foo/bar/ would return /bar/
|
||||||
*
|
*
|
||||||
* @note This method is very architecture dependent, please check the concrete implementation for more information.
|
* @note This method is very architecture dependent, please check the concrete implementation for more information.
|
||||||
*/
|
*/
|
||||||
virtual String getName() const = 0;
|
virtual String getName() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the 'path' of the current node, usable in fopen().
|
* Returns the 'path' of the current node, usable in fopen().
|
||||||
*/
|
*/
|
||||||
virtual String getPath() const = 0;
|
virtual String getPath() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether this path refers to a directory or not.
|
* Indicates whether this path refers to a directory or not.
|
||||||
*/
|
*/
|
||||||
virtual bool isDirectory() const = 0;
|
virtual bool isDirectory() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the object referred by this path can be read from or not.
|
* Indicates whether the object referred by this path can be read from or not.
|
||||||
*
|
*
|
||||||
* If the path refers to a directory, readability implies being able to read
|
* If the path refers to a directory, readability implies being able to read
|
||||||
* and list the directory entries.
|
* and list the directory entries.
|
||||||
*
|
*
|
||||||
* If the path refers to a file, readability implies being able to read the
|
* If the path refers to a file, readability implies being able to read the
|
||||||
* contents of the file.
|
* contents of the file.
|
||||||
*
|
*
|
||||||
* @return bool true if the object can be read, false otherwise.
|
* @return bool true if the object can be read, false otherwise.
|
||||||
*/
|
*/
|
||||||
virtual bool isReadable() const = 0;
|
virtual bool isReadable() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the object referred by this path can be written to or not.
|
* Indicates whether the object referred by this path can be written to or not.
|
||||||
*
|
*
|
||||||
* If the path refers to a directory, writability implies being able to modify
|
* If the path refers to a directory, writability implies being able to modify
|
||||||
* the directory entry (i.e. rename the directory, remove it or write files inside of it).
|
* the directory entry (i.e. rename the directory, remove it or write files inside of it).
|
||||||
*
|
*
|
||||||
* If the path refers to a file, writability implies being able to write data
|
* If the path refers to a file, writability implies being able to write data
|
||||||
* to the file.
|
* to the file.
|
||||||
*
|
*
|
||||||
* @return bool true if the object can be written to, false otherwise.
|
* @return bool true if the object can be written to, false otherwise.
|
||||||
*/
|
*/
|
||||||
virtual bool isWritable() const = 0;
|
virtual bool isWritable() const = 0;
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates AmigaOSFilesystemNode objects.
|
* Creates AmigaOSFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class AmigaOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<AmigaOSFilesystemFactory> {
|
class AmigaOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<AmigaOSFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AmigaOSFilesystemFactory() {};
|
AmigaOSFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,7 +46,7 @@ const uint32 kExAllBufferSize = 40960; // TODO: is this okay for sure?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API.
|
* Implementation of the ScummVM file system API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class AmigaOSFilesystemNode : public AbstractFilesystemNode {
|
class AmigaOSFilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -56,11 +56,11 @@ protected:
|
||||||
String _sPath;
|
String _sPath;
|
||||||
bool _bIsDirectory;
|
bool _bIsDirectory;
|
||||||
bool _bIsValid;
|
bool _bIsValid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the FileInfoBlock protection value for this FilesystemNode,
|
* Obtain the FileInfoBlock protection value for this FilesystemNode,
|
||||||
* as defined in the <proto/dos.h> header.
|
* as defined in the <proto/dos.h> header.
|
||||||
*
|
*
|
||||||
* @return -1 if there were errors, 0 or a positive integer otherwise.
|
* @return -1 if there were errors, 0 or a positive integer otherwise.
|
||||||
*/
|
*/
|
||||||
virtual int getFibProtection() const;
|
virtual int getFibProtection() const;
|
||||||
|
@ -70,14 +70,14 @@ public:
|
||||||
* Creates a AmigaOSFilesystemNode with the root node as path.
|
* Creates a AmigaOSFilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
AmigaOSFilesystemNode();
|
AmigaOSFilesystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a AmigaOSFilesystemNode for a given path.
|
* Creates a AmigaOSFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
*/
|
*/
|
||||||
AmigaOSFilesystemNode(const String &p);
|
AmigaOSFilesystemNode(const String &p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: document this constructor.
|
* FIXME: document this constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -85,11 +85,11 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
*
|
*
|
||||||
* @note Needed because it duplicates the file lock
|
* @note Needed because it duplicates the file lock
|
||||||
*/
|
*/
|
||||||
AmigaOSFilesystemNode(const AmigaOSFilesystemNode &node);
|
AmigaOSFilesystemNode(const AmigaOSFilesystemNode &node);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
|
@ -102,11 +102,11 @@ public:
|
||||||
virtual bool isDirectory() const { return _bIsDirectory; };
|
virtual bool isDirectory() const { return _bIsDirectory; };
|
||||||
virtual bool isReadable() const;
|
virtual bool isReadable() const;
|
||||||
virtual bool isWritable() const;
|
virtual bool isWritable() const;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *getChild(const String &n) const;
|
virtual AbstractFilesystemNode *getChild(const String &n) const;
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFilesystemNode *getParent() const;
|
virtual AbstractFilesystemNode *getParent() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a list with all the volumes present in the root node.
|
* Creates a list with all the volumes present in the root node.
|
||||||
*/
|
*/
|
||||||
|
@ -115,18 +115,18 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* @param str String containing the path.
|
* @param str String containing the path.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
int offset = str.size();
|
int offset = str.size();
|
||||||
|
|
||||||
if (offset <= 0) {
|
if (offset <= 0) {
|
||||||
debug(6, "Bad offset");
|
debug(6, "Bad offset");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *p = str.c_str();
|
const char *p = str.c_str();
|
||||||
|
|
||||||
while (offset > 0 && (p[offset-1] == '/' || p[offset-1] == ':'))
|
while (offset > 0 && (p[offset-1] == '/' || p[offset-1] == ':'))
|
||||||
|
@ -189,7 +189,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p) {
|
||||||
else {
|
else {
|
||||||
//_bIsDirectory = false;
|
//_bIsDirectory = false;
|
||||||
_bIsValid = true;
|
_bIsValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IDOS->UnLock(pLock);
|
IDOS->UnLock(pLock);
|
||||||
|
@ -220,7 +220,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayNam
|
||||||
delete [] n;
|
delete [] n;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bufSize *= 2;
|
bufSize *= 2;
|
||||||
delete [] n;
|
delete [] n;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayNam
|
||||||
else {
|
else {
|
||||||
//_bIsDirectory = false;
|
//_bIsDirectory = false;
|
||||||
_bIsValid = true;
|
_bIsValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IDOS->FreeDosObject(DOS_FIB, fib);
|
IDOS->FreeDosObject(DOS_FIB, fib);
|
||||||
|
@ -277,23 +277,23 @@ bool AmigaOSFilesystemNode::exists() const {
|
||||||
ENTER();
|
ENTER();
|
||||||
if(_sPath.empty())
|
if(_sPath.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool nodeExists = false;
|
bool nodeExists = false;
|
||||||
|
|
||||||
struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL);
|
struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL);
|
||||||
if (!fib) {
|
if (!fib) {
|
||||||
debug(6, "FileInfoBlock is NULL");
|
debug(6, "FileInfoBlock is NULL");
|
||||||
LEAVE();
|
LEAVE();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK);
|
BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK);
|
||||||
if (pLock) {
|
if (pLock) {
|
||||||
if (IDOS->Examine(pLock, fib) != DOSFALSE)
|
if (IDOS->Examine(pLock, fib) != DOSFALSE)
|
||||||
nodeExists = true;
|
nodeExists = true;
|
||||||
IDOS->UnLock(pLock);
|
IDOS->UnLock(pLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDOS->FreeDosObject(DOS_FIB, fib);
|
IDOS->FreeDosObject(DOS_FIB, fib);
|
||||||
LEAVE();
|
LEAVE();
|
||||||
return nodeExists;
|
return nodeExists;
|
||||||
|
@ -402,13 +402,13 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
}
|
}
|
||||||
|
|
||||||
LEAVE();
|
LEAVE();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AmigaOSFilesystemNode::getFibProtection() const {
|
int AmigaOSFilesystemNode::getFibProtection() const {
|
||||||
ENTER();
|
ENTER();
|
||||||
|
|
||||||
int fibProt = -1;
|
int fibProt = -1;
|
||||||
struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL);
|
struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL);
|
||||||
if (!fib) {
|
if (!fib) {
|
||||||
|
@ -416,7 +416,7 @@ int AmigaOSFilesystemNode::getFibProtection() const {
|
||||||
LEAVE();
|
LEAVE();
|
||||||
return fibProt;
|
return fibProt;
|
||||||
}
|
}
|
||||||
|
|
||||||
BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK);
|
BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK);
|
||||||
if (pLock) {
|
if (pLock) {
|
||||||
if (IDOS->Examine(pLock, fib) != DOSFALSE) {
|
if (IDOS->Examine(pLock, fib) != DOSFALSE) {
|
||||||
|
@ -424,7 +424,7 @@ int AmigaOSFilesystemNode::getFibProtection() const {
|
||||||
}
|
}
|
||||||
IDOS->UnLock(pLock);
|
IDOS->UnLock(pLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
IDOS->FreeDosObject(DOS_FIB, fib);
|
IDOS->FreeDosObject(DOS_FIB, fib);
|
||||||
LEAVE();
|
LEAVE();
|
||||||
return fibProt;
|
return fibProt;
|
||||||
|
@ -456,39 +456,39 @@ AbstractFilesystemNode *AmigaOSFilesystemNode::getParent() const {
|
||||||
node = new AmigaOSFilesystemNode();
|
node = new AmigaOSFilesystemNode();
|
||||||
|
|
||||||
LEAVE();
|
LEAVE();
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AmigaOSFilesystemNode::isReadable() const {
|
bool AmigaOSFilesystemNode::isReadable() const {
|
||||||
bool readable = false;
|
bool readable = false;
|
||||||
int fibProt = getFibProtection();
|
int fibProt = getFibProtection();
|
||||||
|
|
||||||
if (fibProt >= 0) {
|
if (fibProt >= 0) {
|
||||||
/* The fib_Protection flag is low-active or inverted, thus the negation.
|
/* The fib_Protection flag is low-active or inverted, thus the negation.
|
||||||
*
|
*
|
||||||
* For more information, consult the compiler/include/dos/dos.h
|
* For more information, consult the compiler/include/dos/dos.h
|
||||||
* file from the AROS source (http://aros.sourceforge.net/).
|
* file from the AROS source (http://aros.sourceforge.net/).
|
||||||
*/
|
*/
|
||||||
readable = !(fibProt & FIBF_READ);
|
readable = !(fibProt & FIBF_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
return readable;
|
return readable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AmigaOSFilesystemNode::isWritable() const {
|
bool AmigaOSFilesystemNode::isWritable() const {
|
||||||
bool writable = false;
|
bool writable = false;
|
||||||
int fibProt = getFibProtection();
|
int fibProt = getFibProtection();
|
||||||
|
|
||||||
if (fibProt >= 0) {
|
if (fibProt >= 0) {
|
||||||
/* The fib_Protection flag is low-active or inverted, thus the negation.
|
/* The fib_Protection flag is low-active or inverted, thus the negation.
|
||||||
*
|
*
|
||||||
* For more information, consult the compiler/include/dos/dos.h
|
* For more information, consult the compiler/include/dos/dos.h
|
||||||
* file from the AROS source (http://aros.sourceforge.net/).
|
* file from the AROS source (http://aros.sourceforge.net/).
|
||||||
*/
|
*/
|
||||||
writable = !(fibProt & FIBF_WRITE);
|
writable = !(fibProt & FIBF_WRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return writable;
|
return writable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const {
|
||||||
dosList->dol_Name &&
|
dosList->dol_Name &&
|
||||||
dosList->dol_Task) {
|
dosList->dol_Task) {
|
||||||
//const char *volName = (const char *)BADDR(dosList->dol_Name)+1;
|
//const char *volName = (const char *)BADDR(dosList->dol_Name)+1;
|
||||||
|
|
||||||
// Copy name to buffer
|
// Copy name to buffer
|
||||||
IDOS->CopyStringBSTRToC(dosList->dol_Name, buffer, MAXPATHLEN);
|
IDOS->CopyStringBSTRToC(dosList->dol_Name, buffer, MAXPATHLEN);
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const {
|
||||||
|
|
||||||
// Find device name
|
// Find device name
|
||||||
IDOS->DevNameFromLock(volumeLock, devName, MAXPATHLEN, DN_DEVICEONLY);
|
IDOS->DevNameFromLock(volumeLock, devName, MAXPATHLEN, DN_DEVICEONLY);
|
||||||
|
|
||||||
sprintf(buffer, "%s (%s)", volName, devName);
|
sprintf(buffer, "%s (%s)", volName, devName);
|
||||||
|
|
||||||
delete [] devName;
|
delete [] devName;
|
||||||
|
@ -562,7 +562,7 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const {
|
||||||
IDOS->UnLockDosList(kLockFlags);
|
IDOS->UnLockDosList(kLockFlags);
|
||||||
|
|
||||||
LEAVE();
|
LEAVE();
|
||||||
|
|
||||||
return myList;
|
return myList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on Ronin.
|
* Implementation of the ScummVM file system API based on Ronin.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class RoninCDFilesystemNode : public AbstractFilesystemNode {
|
class RoninCDFilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -47,10 +47,10 @@ public:
|
||||||
* Creates a RoninCDFilesystemNode with the root node as path.
|
* Creates a RoninCDFilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
RoninCDFilesystemNode();
|
RoninCDFilesystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a RoninCDFilesystemNode for a given path.
|
* Creates a RoninCDFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
* @param verify true if the isValid and isDirectory flags should be verified during the construction.
|
* @param verify true if the isValid and isDirectory flags should be verified during the construction.
|
||||||
*/
|
*/
|
||||||
|
@ -71,18 +71,18 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* /foo/bar.txt would return /bar.txt
|
* /foo/bar.txt would return /bar.txt
|
||||||
* /foo/bar/ would return /bar/
|
* /foo/bar/ would return /bar/
|
||||||
*
|
*
|
||||||
* @param str String containing the path.
|
* @param str String containing the path.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *start = str.c_str();
|
const char *start = str.c_str();
|
||||||
const char *cur = start + str.size() - 2;
|
const char *cur = start + str.size() - 2;
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ AbstractFilesystemNode *RoninCDFilesystemNode::getChild(const String &n) const {
|
||||||
// FIXME: Pretty lame implementation! We do no error checking to speak
|
// FIXME: Pretty lame implementation! We do no error checking to speak
|
||||||
// of, do not check if this is a special node, etc.
|
// of, do not check if this is a special node, etc.
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
String newPath(_path);
|
String newPath(_path);
|
||||||
if (_path.lastChar() != '/')
|
if (_path.lastChar() != '/')
|
||||||
newPath += '/';
|
newPath += '/';
|
||||||
|
@ -140,9 +140,9 @@ AbstractFilesystemNode *RoninCDFilesystemNode::getChild(const String &n) const {
|
||||||
|
|
||||||
bool RoninCDFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
|
bool RoninCDFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
//TODO: honor the hidden flag
|
//TODO: honor the hidden flag
|
||||||
|
|
||||||
DIR *dirp = opendir(_path.c_str());
|
DIR *dirp = opendir(_path.c_str());
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
|
|
||||||
|
@ -172,11 +172,11 @@ bool RoninCDFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
|
|
||||||
if (entry._isDirectory)
|
if (entry._isDirectory)
|
||||||
entry._path += "/";
|
entry._path += "/";
|
||||||
|
|
||||||
myList.push_back(new RoninCDFilesystemNode(entry));
|
myList.push_back(new RoninCDFilesystemNode(entry));
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates RoninCDFilesystemNode objects.
|
* Creates RoninCDFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class RoninCDFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<RoninCDFilesystemFactory> {
|
class RoninCDFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<RoninCDFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RoninCDFilesystemFactory() {};
|
RoninCDFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates DSFilesystemNode objects.
|
* Creates DSFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class DSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<DSFilesystemFactory> {
|
class DSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<DSFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DSFilesystemFactory() {};
|
DSFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -49,7 +49,7 @@ DSFileSystemNode::DSFileSystemNode() {
|
||||||
_archive = (GBFS_FILE *) find_first_gbfs_file(scummdata);
|
_archive = (GBFS_FILE *) find_first_gbfs_file(scummdata);
|
||||||
if (!_archive) consolePrintf("No GBFS archive found!\n");
|
if (!_archive) consolePrintf("No GBFS archive found!\n");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (!_zipFile) {
|
if (!_zipFile) {
|
||||||
_zipFile = new ZipFile();
|
_zipFile = new ZipFile();
|
||||||
}
|
}
|
||||||
|
@ -57,19 +57,19 @@ DSFileSystemNode::DSFileSystemNode() {
|
||||||
|
|
||||||
DSFileSystemNode::DSFileSystemNode(const String& path) {
|
DSFileSystemNode::DSFileSystemNode(const String& path) {
|
||||||
// consolePrintf("--%s ",path.c_str());
|
// consolePrintf("--%s ",path.c_str());
|
||||||
|
|
||||||
char disp[128];
|
char disp[128];
|
||||||
char* pathStr = (char *) path.c_str();
|
char* pathStr = (char *) path.c_str();
|
||||||
|
|
||||||
int lastSlash = 3;
|
int lastSlash = 3;
|
||||||
for (int r = 0; r < (int) strlen(pathStr) - 1; r++) {
|
for (int r = 0; r < (int) strlen(pathStr) - 1; r++) {
|
||||||
if (path[r] == '\\') {
|
if (path[r] == '\\') {
|
||||||
lastSlash = r;
|
lastSlash = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(disp, pathStr + lastSlash + 1);
|
strcpy(disp, pathStr + lastSlash + 1);
|
||||||
|
|
||||||
_displayName = String(disp);
|
_displayName = String(disp);
|
||||||
_path = path;
|
_path = path;
|
||||||
// _isValid = true;
|
// _isValid = true;
|
||||||
|
@ -78,13 +78,13 @@ DSFileSystemNode::DSFileSystemNode(const String& path) {
|
||||||
if (!strncmp(pathStr, "ds:/", 4)) {
|
if (!strncmp(pathStr, "ds:/", 4)) {
|
||||||
pathStr += 4;
|
pathStr += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*pathStr == '\0') {
|
if (*pathStr == '\0') {
|
||||||
_isValid = true;
|
_isValid = true;
|
||||||
_isDirectory = true;
|
_isDirectory = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_zipFile->setAllFilesVisible(true);
|
_zipFile->setAllFilesVisible(true);
|
||||||
if (_zipFile->findFile(pathStr)) {
|
if (_zipFile->findFile(pathStr)) {
|
||||||
_isValid = true;
|
_isValid = true;
|
||||||
|
@ -94,13 +94,13 @@ DSFileSystemNode::DSFileSystemNode(const String& path) {
|
||||||
_isDirectory = false;
|
_isDirectory = false;
|
||||||
}
|
}
|
||||||
_zipFile->setAllFilesVisible(false);
|
_zipFile->setAllFilesVisible(false);
|
||||||
|
|
||||||
// consolePrintf("%s - Found: %d, Dir: %d\n", pathStr, _isValid, _isDirectory);
|
// consolePrintf("%s - Found: %d, Dir: %d\n", pathStr, _isValid, _isDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
DSFileSystemNode::DSFileSystemNode(const String& path, bool isDir) {
|
DSFileSystemNode::DSFileSystemNode(const String& path, bool isDir) {
|
||||||
// consolePrintf("--%s ",path.c_str());
|
// consolePrintf("--%s ",path.c_str());
|
||||||
|
|
||||||
char disp[128];
|
char disp[128];
|
||||||
char* pathStr = (char *) path.c_str();
|
char* pathStr = (char *) path.c_str();
|
||||||
int lastSlash = 3;
|
int lastSlash = 3;
|
||||||
|
@ -109,14 +109,14 @@ DSFileSystemNode::DSFileSystemNode(const String& path, bool isDir) {
|
||||||
lastSlash = r;
|
lastSlash = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(disp, pathStr + lastSlash + 1);
|
strcpy(disp, pathStr + lastSlash + 1);
|
||||||
|
|
||||||
_displayName = String(disp);
|
_displayName = String(disp);
|
||||||
_path = path;
|
_path = path;
|
||||||
_isValid = true;
|
_isValid = true;
|
||||||
_isDirectory = isDir;
|
_isDirectory = isDir;
|
||||||
|
|
||||||
// consolePrintf("Found: %d, Dir: %d\n", _isValid, _isDirectory);
|
// consolePrintf("Found: %d, Dir: %d\n", _isValid, _isDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ AbstractFilesystemNode *DSFileSystemNode::getChild(const Common::String& n) cons
|
||||||
} else {
|
} else {
|
||||||
return new DSFileSystemNode(_path + "\\" + n);
|
return new DSFileSystemNode(_path + "\\" + n);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool
|
||||||
_zipFile->changeDirectory(&temp[4]);
|
_zipFile->changeDirectory(&temp[4]);
|
||||||
} else {
|
} else {
|
||||||
_zipFile->changeToRoot();
|
_zipFile->changeToRoot();
|
||||||
|
|
||||||
/* // This is the root dir, so add the RAM folder
|
/* // This is the root dir, so add the RAM folder
|
||||||
DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/ram");
|
DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/ram");
|
||||||
dsfsn->_isDirectory = true;
|
dsfsn->_isDirectory = true;
|
||||||
|
@ -160,21 +160,21 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool
|
||||||
} else {
|
} else {
|
||||||
_zipFile->changeDirectory(temp);
|
_zipFile->changeDirectory(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_zipFile->restartFile()) {
|
if (_zipFile->restartFile()) {
|
||||||
do {
|
do {
|
||||||
char n[128];
|
char n[128];
|
||||||
_zipFile->getFileName(n);
|
_zipFile->getFileName(n);
|
||||||
|
|
||||||
// consolePrintf("file: %s\n", n);
|
// consolePrintf("file: %s\n", n);
|
||||||
if ( (_zipFile->isDirectory() && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll)) )
|
if ( (_zipFile->isDirectory() && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll)) )
|
||||||
|| (!_zipFile->isDirectory() && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll)) ) )
|
|| (!_zipFile->isDirectory() && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll)) ) )
|
||||||
{
|
{
|
||||||
DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + String(n), _zipFile->isDirectory());
|
DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + String(n), _zipFile->isDirectory());
|
||||||
dsfsn->_isDirectory = _zipFile->isDirectory();
|
dsfsn->_isDirectory = _zipFile->isDirectory();
|
||||||
dirList.push_back((dsfsn));
|
dirList.push_back((dsfsn));
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (_zipFile->skipFile());
|
} while (_zipFile->skipFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,10 +185,10 @@ AbstractFilesystemNode* DSFileSystemNode::getParent() const {
|
||||||
// consolePrintf("parent\n");
|
// consolePrintf("parent\n");
|
||||||
DSFileSystemNode *p;
|
DSFileSystemNode *p;
|
||||||
|
|
||||||
if (_path != "ds:/") {
|
if (_path != "ds:/") {
|
||||||
char *path = (char *) _path.c_str();
|
char *path = (char *) _path.c_str();
|
||||||
int lastSlash = 4;
|
int lastSlash = 4;
|
||||||
|
|
||||||
for (int r = 4; r < (int) strlen((char *) path); r++) {
|
for (int r = 4; r < (int) strlen((char *) path); r++) {
|
||||||
if (path[r] == '\\') {
|
if (path[r] == '\\') {
|
||||||
lastSlash = r;
|
lastSlash = r;
|
||||||
|
@ -218,7 +218,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode() {
|
||||||
|
|
||||||
GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) {
|
GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) {
|
||||||
// consolePrintf("'%s'",path.c_str());
|
// consolePrintf("'%s'",path.c_str());
|
||||||
|
|
||||||
char disp[128];
|
char disp[128];
|
||||||
char* pathStr = (char *) path.c_str();
|
char* pathStr = (char *) path.c_str();
|
||||||
int lastSlash = 3;
|
int lastSlash = 3;
|
||||||
|
@ -227,12 +227,12 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) {
|
||||||
lastSlash = r;
|
lastSlash = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(disp, pathStr + lastSlash + 1);
|
strcpy(disp, pathStr + lastSlash + 1);
|
||||||
|
|
||||||
char check[128];
|
char check[128];
|
||||||
int success;
|
int success;
|
||||||
|
|
||||||
memset(check, 0, 128);
|
memset(check, 0, 128);
|
||||||
if (strlen(pathStr) > 3) {
|
if (strlen(pathStr) > 3) {
|
||||||
strcpy(check, pathStr + 3);
|
strcpy(check, pathStr + 3);
|
||||||
|
@ -244,7 +244,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) {
|
||||||
success = FT_DIR;
|
success = FT_DIR;
|
||||||
}
|
}
|
||||||
// consolePrintf("Path: %s (%d)\n", check, success);
|
// consolePrintf("Path: %s (%d)\n", check, success);
|
||||||
|
|
||||||
_displayName = String(disp);
|
_displayName = String(disp);
|
||||||
_path = path;
|
_path = path;
|
||||||
_isValid = success == FT_FILE;
|
_isValid = success == FT_FILE;
|
||||||
|
@ -253,7 +253,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) {
|
||||||
|
|
||||||
GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path, bool isDirectory) {
|
GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path, bool isDirectory) {
|
||||||
// consolePrintf("'%s'",path.c_str());
|
// consolePrintf("'%s'",path.c_str());
|
||||||
|
|
||||||
char disp[128];
|
char disp[128];
|
||||||
char* pathStr = (char *) path.c_str();
|
char* pathStr = (char *) path.c_str();
|
||||||
int lastSlash = 3;
|
int lastSlash = 3;
|
||||||
|
@ -262,7 +262,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path, bool isDirectory) {
|
||||||
lastSlash = r;
|
lastSlash = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(disp, pathStr + lastSlash + 1);
|
strcpy(disp, pathStr + lastSlash + 1);
|
||||||
|
|
||||||
_displayName = String(disp);
|
_displayName = String(disp);
|
||||||
|
@ -282,7 +282,7 @@ AbstractFilesystemNode *GBAMPFileSystemNode::getChild(const Common::String& n) c
|
||||||
} else {
|
} else {
|
||||||
return new DSFileSystemNode(_path + "\\" + n);
|
return new DSFileSystemNode(_path + "\\" + n);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,12 +292,12 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo
|
||||||
//TODO: honor the hidden flag
|
//TODO: honor the hidden flag
|
||||||
|
|
||||||
enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
|
enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
|
||||||
|
|
||||||
char temp[128], fname[256], *path, *pathTemp;
|
char temp[128], fname[256], *path, *pathTemp;
|
||||||
strcpy(temp, _path.c_str());
|
strcpy(temp, _path.c_str());
|
||||||
|
|
||||||
path = temp + 3;
|
path = temp + 3;
|
||||||
|
|
||||||
pathTemp = path;
|
pathTemp = path;
|
||||||
while (*pathTemp) {
|
while (*pathTemp) {
|
||||||
if (*pathTemp == '\\') {
|
if (*pathTemp == '\\') {
|
||||||
|
@ -308,37 +308,37 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo
|
||||||
|
|
||||||
consolePrintf("This dir: %s\n", path);
|
consolePrintf("This dir: %s\n", path);
|
||||||
FAT_chdir(path);
|
FAT_chdir(path);
|
||||||
|
|
||||||
int entryType = FAT_FindFirstFileLFN(fname);
|
int entryType = FAT_FindFirstFileLFN(fname);
|
||||||
|
|
||||||
while (entryType != TYPE_NO_MORE) {
|
while (entryType != TYPE_NO_MORE) {
|
||||||
|
|
||||||
if ( ((entryType == TYPE_DIR) && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll)))
|
if ( ((entryType == TYPE_DIR) && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll)))
|
||||||
|| ((entryType == TYPE_FILE) && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll))) ) {
|
|| ((entryType == TYPE_FILE) && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll))) ) {
|
||||||
GBAMPFileSystemNode* dsfsn;
|
GBAMPFileSystemNode* dsfsn;
|
||||||
|
|
||||||
consolePrintf("Fname: %s\n", fname);
|
consolePrintf("Fname: %s\n", fname);
|
||||||
|
|
||||||
if (strcmp(fname, ".") && strcmp(fname, "..")) {
|
if (strcmp(fname, ".") && strcmp(fname, "..")) {
|
||||||
|
|
||||||
if (!strcmp(path, "/")) {
|
if (!strcmp(path, "/")) {
|
||||||
dsfsn = new GBAMPFileSystemNode("mp:" + String(path) + String(fname), entryType == TYPE_DIR);
|
dsfsn = new GBAMPFileSystemNode("mp:" + String(path) + String(fname), entryType == TYPE_DIR);
|
||||||
} else {
|
} else {
|
||||||
dsfsn = new GBAMPFileSystemNode("mp:" + String(path) + String("/") + String(fname), entryType == TYPE_DIR);
|
dsfsn = new GBAMPFileSystemNode("mp:" + String(path) + String("/") + String(fname), entryType == TYPE_DIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dsfsn->_isDirectory = entryType == DIR;
|
// dsfsn->_isDirectory = entryType == DIR;
|
||||||
dirList.push_back((dsfsn));
|
dirList.push_back((dsfsn));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// consolePrintf("Skipping %s\n", fname);
|
// consolePrintf("Skipping %s\n", fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
entryType = FAT_FindNextFileLFN(fname);
|
entryType = FAT_FindNextFileLFN(fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
// consolePrintf("No more");
|
// consolePrintf("No more");
|
||||||
|
|
||||||
FAT_chdir("/");
|
FAT_chdir("/");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -348,10 +348,10 @@ AbstractFilesystemNode* GBAMPFileSystemNode::getParent() const {
|
||||||
// consolePrintf("parent\n");
|
// consolePrintf("parent\n");
|
||||||
GBAMPFileSystemNode *p;
|
GBAMPFileSystemNode *p;
|
||||||
|
|
||||||
if (_path != "mp:/") {
|
if (_path != "mp:/") {
|
||||||
char *path = (char *) _path.c_str();
|
char *path = (char *) _path.c_str();
|
||||||
int lastSlash = 4;
|
int lastSlash = 4;
|
||||||
|
|
||||||
for (int r = 4; r < (int) strlen((char *) path); r++) {
|
for (int r = 4; r < (int) strlen((char *) path); r++) {
|
||||||
if (path[r] == '/') {
|
if (path[r] == '/') {
|
||||||
lastSlash = r;
|
lastSlash = r;
|
||||||
|
@ -381,14 +381,14 @@ FILE* std_fopen(const char* name, const char* mode) {
|
||||||
inited = true;
|
inited = true;
|
||||||
currentDir[0] = '\0';
|
currentDir[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
char* realName = (char *) name;
|
char* realName = (char *) name;
|
||||||
|
|
||||||
// Remove file system prefix
|
// Remove file system prefix
|
||||||
if ((name[0] == 'd') && (name[1] == 's') && (name[2] == ':') && (name[3] == '/')) {
|
if ((name[0] == 'd') && (name[1] == 's') && (name[2] == ':') && (name[3] == '/')) {
|
||||||
realName += 4;
|
realName += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((name[0] == 'm') && (name[1] == 'p') && (name[2] == ':') && (name[3] == '/')) {
|
if ((name[0] == 'm') && (name[1] == 'p') && (name[2] == ':') && (name[3] == '/')) {
|
||||||
realName += 4;
|
realName += 4;
|
||||||
}
|
}
|
||||||
|
@ -398,15 +398,15 @@ FILE* std_fopen(const char* name, const char* mode) {
|
||||||
|
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
FAT_chdir("/");
|
FAT_chdir("/");
|
||||||
|
|
||||||
char* p = realName;
|
char* p = realName;
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (*p == '\\') *p = '/';
|
if (*p == '\\') *p = '/';
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
FAT_FILE* result = FAT_fopen(realName, mode);
|
FAT_FILE* result = FAT_fopen(realName, mode);
|
||||||
|
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
// consolePrintf("Error code %d\n", result);
|
// consolePrintf("Error code %d\n", result);
|
||||||
//consolePrintf("Opening file %s\n", realName);
|
//consolePrintf("Opening file %s\n", realName);
|
||||||
|
@ -414,16 +414,16 @@ FILE* std_fopen(const char* name, const char* mode) {
|
||||||
// consolePrintf("Opened file %d\n", result);
|
// consolePrintf("Opened file %d\n", result);
|
||||||
}
|
}
|
||||||
// MT_memoryReport();
|
// MT_memoryReport();
|
||||||
|
|
||||||
return (FILE *) result;
|
return (FILE *) result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fail to open file for writing. It's in ROM!
|
// Fail to open file for writing. It's in ROM!
|
||||||
|
|
||||||
// Allocate a file handle
|
// Allocate a file handle
|
||||||
int r = 0;
|
int r = 0;
|
||||||
while (handle[r].used) r++;
|
while (handle[r].used) r++;
|
||||||
|
|
||||||
if (strchr(mode, 'w')) {
|
if (strchr(mode, 'w')) {
|
||||||
// consolePrintf("Writing %s\n", realName);
|
// consolePrintf("Writing %s\n", realName);
|
||||||
handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, true);
|
handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, true);
|
||||||
|
@ -439,22 +439,22 @@ FILE* std_fopen(const char* name, const char* mode) {
|
||||||
handle[r].size = handle[r].sramFile->getSize();
|
handle[r].size = handle[r].sramFile->getSize();
|
||||||
// consolePrintf("Found it");
|
// consolePrintf("Found it");
|
||||||
return &handle[r];
|
return &handle[r];
|
||||||
}
|
}
|
||||||
|
|
||||||
// consolePrintf("Not in SRAM!");
|
// consolePrintf("Not in SRAM!");
|
||||||
|
|
||||||
char* data;
|
char* data;
|
||||||
|
|
||||||
ZipFile* zip = DSFileSystemNode::getZip();
|
ZipFile* zip = DSFileSystemNode::getZip();
|
||||||
if (!zip) {
|
if (!zip) {
|
||||||
// consolePrintf("No zip yet!");
|
// consolePrintf("No zip yet!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the data if it exists
|
// Grab the data if it exists
|
||||||
|
|
||||||
zip->setAllFilesVisible(true);
|
zip->setAllFilesVisible(true);
|
||||||
|
|
||||||
if (currentDir[0] != 0) {
|
if (currentDir[0] != 0) {
|
||||||
char nameWithPath[128];
|
char nameWithPath[128];
|
||||||
sprintf(nameWithPath, "%s\%s", currentDir, realName);
|
sprintf(nameWithPath, "%s\%s", currentDir, realName);
|
||||||
|
@ -462,16 +462,16 @@ FILE* std_fopen(const char* name, const char* mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// consolePrintf("fopen(%s, %s)\n", realName, name);
|
// consolePrintf("fopen(%s, %s)\n", realName, name);
|
||||||
|
|
||||||
if (zip->findFile(realName)) {
|
if (zip->findFile(realName)) {
|
||||||
data = zip->getFile();
|
data = zip->getFile();
|
||||||
zip->setAllFilesVisible(false);
|
zip->setAllFilesVisible(false);
|
||||||
|
|
||||||
// Allocate a file handle
|
// Allocate a file handle
|
||||||
int r = 0;
|
int r = 0;
|
||||||
while (handle[r].used) r++;
|
while (handle[r].used) r++;
|
||||||
|
|
||||||
|
|
||||||
handle[r].used = true;
|
handle[r].used = true;
|
||||||
handle[r].pos = 0;
|
handle[r].pos = 0;
|
||||||
handle[r].data = data;
|
handle[r].data = data;
|
||||||
|
@ -512,26 +512,26 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
||||||
return bytes / size;
|
return bytes / size;
|
||||||
}
|
}
|
||||||
return numItems;
|
return numItems;
|
||||||
|
|
||||||
/* int item = 0;
|
/* int item = 0;
|
||||||
u8* data = (u8 *) ptr;
|
u8* data = (u8 *) ptr;
|
||||||
while ((item < numItems) && (!FAT_feof((FAT_FILE *) handle))) {
|
while ((item < numItems) && (!FAT_feof((FAT_FILE *) handle))) {
|
||||||
|
|
||||||
|
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
while ((bytes < size) && (!FAT_feof((FAT_FILE *) handle))) {
|
while ((bytes < size) && (!FAT_feof((FAT_FILE *) handle))) {
|
||||||
*data++ = FAT_fgetc((FAT_FILE *) handle);
|
*data++ = FAT_fgetc((FAT_FILE *) handle);
|
||||||
bytes++;
|
bytes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
item++;
|
item++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
*/
|
*/
|
||||||
int items = 0;
|
int items = 0;
|
||||||
|
|
||||||
//for (int r = 0; r < numItems; r++) {
|
//for (int r = 0; r < numItems; r++) {
|
||||||
if (!std_feof(handle)) {
|
if (!std_feof(handle)) {
|
||||||
/* for (int t = 0; t < size; t++) {
|
/* for (int t = 0; t < size; t++) {
|
||||||
|
@ -540,7 +540,7 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
||||||
}*/
|
}*/
|
||||||
int left = size * numItems;
|
int left = size * numItems;
|
||||||
int bytesRead = -1;
|
int bytesRead = -1;
|
||||||
|
|
||||||
while ((left > 0) && (!FAT_feof((FAT_FILE *) handle))) {
|
while ((left > 0) && (!FAT_feof((FAT_FILE *) handle))) {
|
||||||
int amount = left > 8192? 8192: left;
|
int amount = left > 8192? 8192: left;
|
||||||
// do {
|
// do {
|
||||||
|
@ -548,9 +548,9 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
||||||
/* if (bytesRead == 0) {
|
/* if (bytesRead == 0) {
|
||||||
consolePrintf("Pos:%d items:%d num:%d amount:%d read:%d\n", ftell(handle), items, numItems, amount, bytesRead);
|
consolePrintf("Pos:%d items:%d num:%d amount:%d read:%d\n", ftell(handle), items, numItems, amount, bytesRead);
|
||||||
left++;
|
left++;
|
||||||
|
|
||||||
int pos = ftell(handle);
|
int pos = ftell(handle);
|
||||||
|
|
||||||
fseek(handle, 0, SEEK_SET);
|
fseek(handle, 0, SEEK_SET);
|
||||||
int c = getc(handle);
|
int c = getc(handle);
|
||||||
fseek(handle, pos - 1024, SEEK_SET);
|
fseek(handle, pos - 1024, SEEK_SET);
|
||||||
|
@ -562,21 +562,21 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
||||||
} while (bytesRead == 0);
|
} while (bytesRead == 0);
|
||||||
*/
|
*/
|
||||||
left -= bytesRead;
|
left -= bytesRead;
|
||||||
ptr = ((char *) (ptr)) + bytesRead;
|
ptr = ((char *) (ptr)) + bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
items = numItems - (left / size);
|
items = numItems - (left / size);
|
||||||
|
|
||||||
// FAT_fread((void *) ptr, size, 1, ((int) (handle)) - 1);
|
// FAT_fread((void *) ptr, size, 1, ((int) (handle)) - 1);
|
||||||
// ptr = ((char *) (ptr)) + size;
|
// ptr = ((char *) (ptr)) + size;
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// consolePrintf("...done %d \n", items)
|
// consolePrintf("...done %d \n", items)
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->sramFile) {
|
if (handle->sramFile) {
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
@ -586,9 +586,9 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
||||||
bytes += result;
|
bytes += result;
|
||||||
//consolePrintf("'%d',", ((char *) (ptr))[0]);
|
//consolePrintf("'%d',", ((char *) (ptr))[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->pos += bytes;
|
handle->pos += bytes;
|
||||||
|
|
||||||
return bytes / size;
|
return bytes / size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,7 +607,7 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
||||||
|
|
||||||
size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
||||||
if ((handle == stdin)) return 0;
|
if ((handle == stdin)) return 0;
|
||||||
|
|
||||||
if ((handle == stderr) || (handle == stdout)) {
|
if ((handle == stderr) || (handle == stdout)) {
|
||||||
// consolePrintf((char *) ptr);
|
// consolePrintf((char *) ptr);
|
||||||
return size;
|
return size;
|
||||||
|
@ -618,18 +618,18 @@ size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle) {
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
FAT_fwrite(((char *) (ptr)), size, numItems, (FAT_FILE *) handle);
|
FAT_fwrite(((char *) (ptr)), size, numItems, (FAT_FILE *) handle);
|
||||||
return numItems;
|
return numItems;
|
||||||
|
|
||||||
int length = size * numItems;
|
int length = size * numItems;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
while (pos < length) {
|
while (pos < length) {
|
||||||
int amount = length > 512? 512: length;
|
int amount = length > 512? 512: length;
|
||||||
|
|
||||||
FAT_fwrite(((char *) (ptr)) + pos, 1, amount, (FAT_FILE *) handle);
|
FAT_fwrite(((char *) (ptr)) + pos, 1, amount, (FAT_FILE *) handle);
|
||||||
length -= amount;
|
length -= amount;
|
||||||
pos += amount;
|
pos += amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return numItems;
|
return numItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ bool std_feof(FILE* handle) {
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
return FAT_feof((FAT_FILE *) handle);
|
return FAT_feof((FAT_FILE *) handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->sramFile) {
|
if (handle->sramFile) {
|
||||||
return handle->sramFile->eos();
|
return handle->sramFile->eos();
|
||||||
}
|
}
|
||||||
|
@ -667,19 +667,19 @@ void std_fflush(FILE* handle) {
|
||||||
|
|
||||||
char* std_fgets(char* str, int size, FILE* file) {
|
char* std_fgets(char* str, int size, FILE* file) {
|
||||||
// consolePrintf("fgets file=%d ", file);
|
// consolePrintf("fgets file=%d ", file);
|
||||||
|
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
char* s = str;
|
char* s = str;
|
||||||
while ((*s++ = std_getc(file)) >= 32) {
|
while ((*s++ = std_getc(file)) >= 32) {
|
||||||
// consolePrintf("%d ", *s);
|
// consolePrintf("%d ", *s);
|
||||||
}
|
}
|
||||||
*s = 0;
|
*s = 0;
|
||||||
|
|
||||||
// consolePrintf("Read:%s\n", str);
|
// consolePrintf("Read:%s\n", str);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->sramFile) {
|
if (file->sramFile) {
|
||||||
file->pos--;
|
file->pos--;
|
||||||
int p = -1;
|
int p = -1;
|
||||||
|
@ -694,7 +694,7 @@ char* std_fgets(char* str, int size, FILE* file) {
|
||||||
// consolePrintf("Read:%s\n", str);
|
// consolePrintf("Read:%s\n", str);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ int std_fseek(FILE* handle, long int offset, int whence) {
|
||||||
handle->pos = offset;
|
handle->pos = offset;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ int std_getc(FILE* handle) {
|
||||||
if (DS::isGBAMPAvailable()) {
|
if (DS::isGBAMPAvailable()) {
|
||||||
char c;
|
char c;
|
||||||
FAT_fread(&c, 1, 1, (FAT_FILE *) handle);
|
FAT_fread(&c, 1, 1, (FAT_FILE *) handle);
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -763,15 +763,15 @@ void std_cwd(char* dir) {
|
||||||
if ((strlen(dir) >= 4) && (dir[0] == 'm') && (dir[1] == 'p') && (dir[2] == ':') && (dir[3] == '/')) {
|
if ((strlen(dir) >= 4) && (dir[0] == 'm') && (dir[1] == 'p') && (dir[2] == ':') && (dir[3] == '/')) {
|
||||||
realName += 4;
|
realName += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// consolePrintf("Real cwd:%d\n", realName);
|
// consolePrintf("Real cwd:%d\n", realName);
|
||||||
|
|
||||||
char* p = realName;
|
char* p = realName;
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (*p == '\\') *p = '/';
|
if (*p == '\\') *p = '/';
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// consolePrintf("Real cwd:%d\n", realName);
|
// consolePrintf("Real cwd:%d\n", realName);
|
||||||
FAT_chdir(realName);
|
FAT_chdir(realName);
|
||||||
} else {
|
} else {
|
||||||
|
@ -784,13 +784,13 @@ void std_cwd(char* dir) {
|
||||||
if (*p == '\\') *p = '/';
|
if (*p == '\\') *p = '/';
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(currentDir, realName);
|
strcpy(currentDir, realName);
|
||||||
if (*(currentDir + strlen(currentDir) - 1) == '/') {
|
if (*(currentDir + strlen(currentDir) - 1) == '/') {
|
||||||
*(currentDir + strlen(currentDir) - 1) = '\0';
|
*(currentDir + strlen(currentDir) - 1) = '\0';
|
||||||
}
|
}
|
||||||
// consolePrintf("CWD: %s\n", currentDir);
|
// consolePrintf("CWD: %s\n", currentDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int std_ferror(FILE* handle) {
|
int std_ferror(FILE* handle) {
|
||||||
|
@ -801,11 +801,11 @@ int std_ferror(FILE* handle) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* /foo/bar.txt would return /bar.txt
|
* /foo/bar.txt would return /bar.txt
|
||||||
* /foo/bar/ would return /bar/
|
* /foo/bar/ would return /bar/
|
||||||
*
|
*
|
||||||
* @param str String containing the path.
|
* @param str String containing the path.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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 _DS_FS_H
|
#ifndef _DS_FS_H
|
||||||
#define _DS_FS_H
|
#define _DS_FS_H
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace DS {
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API.
|
* Implementation of the ScummVM file system API.
|
||||||
* This class is used when a Flash cart is in use.
|
* This class is used when a Flash cart is in use.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class DSFileSystemNode : public AbstractFilesystemNode {
|
class DSFileSystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -50,33 +50,33 @@ protected:
|
||||||
bool _isDirectory;
|
bool _isDirectory;
|
||||||
bool _isValid;
|
bool _isValid;
|
||||||
int _refCountVal;
|
int _refCountVal;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Creates a DSFilesystemNode with the root node as path.
|
* Creates a DSFilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
DSFileSystemNode();
|
DSFileSystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DSFilesystemNode for a given path.
|
* Creates a DSFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
*/
|
*/
|
||||||
DSFileSystemNode(const String &path);
|
DSFileSystemNode(const String &path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DSFilesystemNode for a given path.
|
* Creates a DSFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
* @param path true if path is a directory, false otherwise.
|
* @param path true if path is a directory, false otherwise.
|
||||||
*/
|
*/
|
||||||
DSFileSystemNode(const String& path, bool isDir);
|
DSFileSystemNode(const String& path, bool isDir);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
*/
|
*/
|
||||||
DSFileSystemNode(const DSFileSystemNode *node);
|
DSFileSystemNode(const DSFileSystemNode *node);
|
||||||
|
|
||||||
virtual bool exists() const { return true; } //FIXME: this is just a stub
|
virtual bool exists() const { return true; } //FIXME: this is just a stub
|
||||||
virtual String getDisplayName() const { return _displayName; }
|
virtual String getDisplayName() const { return _displayName; }
|
||||||
virtual String getName() const { return _displayName; }
|
virtual String getName() const { return _displayName; }
|
||||||
|
@ -84,7 +84,7 @@ public:
|
||||||
virtual bool isDirectory() const { return _isDirectory; }
|
virtual bool isDirectory() const { return _isDirectory; }
|
||||||
virtual bool isReadable() const { return true; } //FIXME: this is just a stub
|
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 bool isWritable() const { return true; } //FIXME: this is just a stub
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a copy of this node.
|
* Returns a copy of this node.
|
||||||
*/
|
*/
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
virtual AbstractFilesystemNode *getChild(const Common::String& name) const;
|
virtual AbstractFilesystemNode *getChild(const Common::String& name) const;
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode = FilesystemNode::kListDirectoriesOnly, bool hidden = false) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode = FilesystemNode::kListDirectoriesOnly, bool hidden = false) const;
|
||||||
virtual AbstractFilesystemNode *getParent() const;
|
virtual AbstractFilesystemNode *getParent() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the zip file this node points to.
|
* Returns the zip file this node points to.
|
||||||
* TODO: check this documentation.
|
* TODO: check this documentation.
|
||||||
|
@ -103,7 +103,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API.
|
* Implementation of the ScummVM file system API.
|
||||||
* This class is used when the GBAMP (GBA Movie Player) is used with a CompactFlash card.
|
* This class is used when the GBAMP (GBA Movie Player) is used with a CompactFlash card.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class GBAMPFileSystemNode : public AbstractFilesystemNode {
|
class GBAMPFileSystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -115,41 +115,41 @@ protected:
|
||||||
bool _isDirectory;
|
bool _isDirectory;
|
||||||
bool _isValid;
|
bool _isValid;
|
||||||
int _refCountVal;
|
int _refCountVal;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Creates a GBAMPFilesystemNode with the root node as path.
|
* Creates a GBAMPFilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
GBAMPFileSystemNode();
|
GBAMPFileSystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a GBAMPFilesystemNode for a given path.
|
* Creates a GBAMPFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
*/
|
*/
|
||||||
GBAMPFileSystemNode(const String &path);
|
GBAMPFileSystemNode(const String &path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DSFilesystemNode for a given path.
|
* Creates a DSFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
* @param path true if path is a directory, false otherwise.
|
* @param path true if path is a directory, false otherwise.
|
||||||
*/
|
*/
|
||||||
GBAMPFileSystemNode(const String &path, bool isDirectory);
|
GBAMPFileSystemNode(const String &path, bool isDirectory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
*/
|
*/
|
||||||
GBAMPFileSystemNode(const GBAMPFileSystemNode *node);
|
GBAMPFileSystemNode(const GBAMPFileSystemNode *node);
|
||||||
|
|
||||||
virtual bool exists() const { return _isValid || _isDirectory; }
|
virtual bool exists() const { return _isValid || _isDirectory; }
|
||||||
virtual String getDisplayName() const { return _displayName; }
|
virtual String getDisplayName() const { return _displayName; }
|
||||||
virtual String getName() const { return _displayName; }
|
virtual String getName() const { return _displayName; }
|
||||||
virtual String getPath() const { return _path; }
|
virtual String getPath() const { return _path; }
|
||||||
virtual bool isDirectory() const { return _isDirectory; }
|
virtual bool isDirectory() const { return _isDirectory; }
|
||||||
virtual bool isReadable() const { return true; } //FIXME: this is just a stub
|
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 bool isWritable() const { return true; } //FIXME: this is just a stub
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a copy of this node.
|
* Returns a copy of this node.
|
||||||
*/
|
*/
|
||||||
|
@ -164,7 +164,7 @@ struct fileHandle {
|
||||||
bool used;
|
bool used;
|
||||||
char* data;
|
char* data;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
DSSaveFile* sramFile;
|
DSSaveFile* sramFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ struct fileHandle {
|
||||||
#define stdin ((DS::fileHandle*) -3)
|
#define stdin ((DS::fileHandle*) -3)
|
||||||
|
|
||||||
#define FILE DS::fileHandle
|
#define FILE DS::fileHandle
|
||||||
|
|
||||||
// Please do not remove any of these prototypes that appear not to be required.
|
// Please do not remove any of these prototypes that appear not to be required.
|
||||||
FILE* std_fopen(const char* name, const char* mode);
|
FILE* std_fopen(const char* name, const char* mode);
|
||||||
void std_fclose(FILE* handle);
|
void std_fclose(FILE* handle);
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates GP32FilesystemNode objects.
|
* Creates GP32FilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class GP32FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<GP32FilesystemFactory> {
|
class GP32FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<GP32FilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GP32FilesystemFactory() {};
|
GP32FilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API.
|
* Implementation of the ScummVM file system API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class GP32FilesystemNode : public AbstractFilesystemNode {
|
class GP32FilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -44,10 +44,10 @@ public:
|
||||||
* Creates a GP32FilesystemNode with the root node as path.
|
* Creates a GP32FilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
GP32FilesystemNode();
|
GP32FilesystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a GP32FilesystemNode for a given path.
|
* Creates a GP32FilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
*/
|
*/
|
||||||
GP32FilesystemNode(const String &path);
|
GP32FilesystemNode(const String &path);
|
||||||
|
@ -72,18 +72,18 @@ const char gpRootPath[] = "gp:\\";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* gp:\foo\bar.txt would return "\bar.txt"
|
* gp:\foo\bar.txt would return "\bar.txt"
|
||||||
* gp:\foo\bar\ would return "\bar\"
|
* gp:\foo\bar\ would return "\bar\"
|
||||||
*
|
*
|
||||||
* @param str Path to obtain the last component from.
|
* @param str Path to obtain the last component from.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *start = str.c_str();
|
const char *start = str.c_str();
|
||||||
const char *cur = start + str.size() - 2;
|
const char *cur = start + str.size() - 2;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ const char *lastPathComponent(const Common::String &str) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: document this function.
|
* FIXME: document this function.
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @param convPath
|
* @param convPath
|
||||||
*/
|
*/
|
||||||
|
@ -165,7 +165,7 @@ GP32FilesystemNode::GP32FilesystemNode(const String &path) {
|
||||||
|
|
||||||
_path = convPath;
|
_path = convPath;
|
||||||
pos = convPath;
|
pos = convPath;
|
||||||
|
|
||||||
while (*pos)
|
while (*pos)
|
||||||
if (*pos++ == '\\')
|
if (*pos++ == '\\')
|
||||||
dsplName = pos;
|
dsplName = pos;
|
||||||
|
@ -186,7 +186,7 @@ AbstractFilesystemNode *GP32FilesystemNode::getChild(const String &n) const {
|
||||||
// FIXME: Pretty lame implementation! We do no error checking to speak
|
// FIXME: Pretty lame implementation! We do no error checking to speak
|
||||||
// of, do not check if this is a special node, etc.
|
// of, do not check if this is a special node, etc.
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
String newPath(_path);
|
String newPath(_path);
|
||||||
if (_path.lastChar() != '\\')
|
if (_path.lastChar() != '\\')
|
||||||
newPath += '\\';
|
newPath += '\\';
|
||||||
|
@ -213,11 +213,11 @@ bool GP32FilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
|
||||||
int startIdx = 0; // current file
|
int startIdx = 0; // current file
|
||||||
String listDir(_path);
|
String listDir(_path);
|
||||||
//listDir += "/";
|
//listDir += "/";
|
||||||
|
|
||||||
while (GpDirEnumList(listDir.c_str(), startIdx++, 1, &dirEntry, &read) == SM_OK) {
|
while (GpDirEnumList(listDir.c_str(), startIdx++, 1, &dirEntry, &read) == SM_OK) {
|
||||||
da if (dirEntry.name[0] == '.')
|
da if (dirEntry.name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
entry._displayName = dirEntry.name;
|
entry._displayName = dirEntry.name;
|
||||||
entry._path = _path;
|
entry._path = _path;
|
||||||
entry._path += dirEntry.name;
|
entry._path += dirEntry.name;
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates ABoxFilesystemNode objects.
|
* Creates ABoxFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class ABoxFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<ABoxFilesystemFactory> {
|
class ABoxFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<ABoxFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ABoxFilesystemFactory() {};
|
ABoxFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on the MorphOS A-Box API.
|
* Implementation of the ScummVM file system API based on the MorphOS A-Box API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class ABoxFilesystemNode : public AbstractFilesystemNode {
|
class ABoxFilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -51,19 +51,19 @@ public:
|
||||||
* Creates a ABoxFilesystemNode with the root node as path.
|
* Creates a ABoxFilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
ABoxFilesystemNode();
|
ABoxFilesystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a ABoxFilesystemNode for a given path.
|
* Creates a ABoxFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
*/
|
*/
|
||||||
ABoxFilesystemNode(const String &p);
|
ABoxFilesystemNode(const String &p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: document this constructor.
|
* FIXME: document this constructor.
|
||||||
*/
|
*/
|
||||||
ABoxFilesystemNode(BPTR lock, CONST_STRPTR display_name = NULL);
|
ABoxFilesystemNode(BPTR lock, CONST_STRPTR display_name = NULL);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -81,11 +81,11 @@ public:
|
||||||
virtual bool isDirectory() const { return _isDirectory; }
|
virtual bool isDirectory() const { return _isDirectory; }
|
||||||
virtual bool isReadable() const { return true; } //FIXME: this is just a stub
|
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 bool isWritable() const { return true; } //FIXME: this is just a stub
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *getChild(const String &name) const;
|
virtual AbstractFilesystemNode *getChild(const String &name) const;
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFilesystemNode *getParent() const;
|
virtual AbstractFilesystemNode *getParent() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of child nodes for the root node.
|
* Return the list of child nodes for the root node.
|
||||||
*/
|
*/
|
||||||
|
@ -94,14 +94,14 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* @param str String containing the path.
|
* @param str String containing the path.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
if (str.empty())
|
if (str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *str = _path.c_str();
|
const char *str = _path.c_str();
|
||||||
while (offset > 0 && (str[offset-1] == '/' || str[offset-1] == ':') )
|
while (offset > 0 && (str[offset-1] == '/' || str[offset-1] == ':') )
|
||||||
offset--;
|
offset--;
|
||||||
|
@ -109,7 +109,7 @@ const char *lastPathComponent(const Common::String &str) {
|
||||||
len++;
|
len++;
|
||||||
offset--;
|
offset--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str + offset;
|
return str + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ ABoxFilesystemNode::ABoxFilesystemNode(const String &p) {
|
||||||
_isValid = true;
|
_isValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UnLock(pLock);
|
UnLock(pLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ ABoxFilesystemNode::ABoxFilesystemNode(BPTR lock, CONST_STRPTR display_name)
|
||||||
_isValid = true;
|
_isValid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeDosObject(DOS_FIB, fib);
|
FreeDosObject(DOS_FIB, fib);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ AbstractFilesystemNode *ABoxFilesystemNode::getChild(const String &name) const {
|
||||||
bool ABoxFilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const
|
bool ABoxFilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const
|
||||||
{
|
{
|
||||||
//TODO: honor the hidden flag
|
//TODO: honor the hidden flag
|
||||||
|
|
||||||
if (!_isValid)
|
if (!_isValid)
|
||||||
{
|
{
|
||||||
debug(6, "listDir() called on invalid node");
|
debug(6, "listDir() called on invalid node");
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates PalmOSFilesystemNode objects.
|
* Creates PalmOSFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class PalmOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> {
|
class PalmOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PalmOSFilesystemFactory() {};
|
PalmOSFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on PalmOS VFS API.
|
* Implementation of the ScummVM file system API based on PalmOS VFS API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class PalmOSFilesystemNode : public AbstractFilesystemNode {
|
class PalmOSFilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -41,16 +41,16 @@ protected:
|
||||||
bool _isDirectory;
|
bool _isDirectory;
|
||||||
bool _isValid;
|
bool _isValid;
|
||||||
bool _isPseudoRoot;
|
bool _isPseudoRoot;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Creates a PalmOSFilesystemNode with the root node as path.
|
* Creates a PalmOSFilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
PalmOSFilesystemNode();
|
PalmOSFilesystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a POSIXFilesystemNode for a given path.
|
* Creates a POSIXFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
*/
|
*/
|
||||||
PalmOSFilesystemNode(const String &p);
|
PalmOSFilesystemNode(const String &p);
|
||||||
|
@ -70,8 +70,8 @@ public:
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Adds a single WindowsFilesystemNode to a given list.
|
* Adds a single WindowsFilesystemNode to a given list.
|
||||||
* This method is used by getChildren() to populate the directory entries list.
|
* This method is used by getChildren() to populate the directory entries list.
|
||||||
*
|
*
|
||||||
* @param list List to put the file entry node in.
|
* @param list List to put the file entry node in.
|
||||||
* @param mode Mode to use while adding the file entry to the list.
|
* @param mode Mode to use while adding the file entry to the list.
|
||||||
* @param base String with the directory being listed.
|
* @param base String with the directory being listed.
|
||||||
|
@ -82,18 +82,18 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* /foo/bar.txt would return /bar.txt
|
* /foo/bar.txt would return /bar.txt
|
||||||
* /foo/bar/ would return /bar/
|
* /foo/bar/ would return /bar/
|
||||||
*
|
*
|
||||||
* @param str String containing the path.
|
* @param str String containing the path.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *start = str.c_str();
|
const char *start = str.c_str();
|
||||||
const char *cur = start + str.size() - 2;
|
const char *cur = start + str.size() - 2;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ void PalmOSFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const ch
|
||||||
if (entry._isDirectory)
|
if (entry._isDirectory)
|
||||||
entry._path += "/";
|
entry._path += "/";
|
||||||
|
|
||||||
entry._isValid = true;
|
entry._isValid = true;
|
||||||
entry._isPseudoRoot = false;
|
entry._isPseudoRoot = false;
|
||||||
|
|
||||||
list.push_back(new PalmOSFilesystemNode(entry));
|
list.push_back(new PalmOSFilesystemNode(entry));
|
||||||
|
@ -161,7 +161,7 @@ PalmOSFilesystemNode::PalmOSFilesystemNode(const String &p) {
|
||||||
|
|
||||||
AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const String &n) const {
|
AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const String &n) const {
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
String newPath(_path);
|
String newPath(_path);
|
||||||
if (_path.lastChar() != '/')
|
if (_path.lastChar() != '/')
|
||||||
newPath += '/';
|
newPath += '/';
|
||||||
|
@ -172,7 +172,7 @@ AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const String &n) const {
|
||||||
Err error = VFSFileOpen(gVars->VFS.volRefNum, newPath.c_str(), vfsModeRead, &handle);
|
Err error = VFSFileOpen(gVars->VFS.volRefNum, newPath.c_str(), vfsModeRead, &handle);
|
||||||
if (error)
|
if (error)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error = VFSFileGetAttributes(handle, &attr);
|
error = VFSFileGetAttributes(handle, &attr);
|
||||||
VFSFileClose(handle);
|
VFSFileClose(handle);
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const String &n) const {
|
||||||
|
|
||||||
bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
|
bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
|
||||||
//TODO: honor the hidden flag
|
//TODO: honor the hidden flag
|
||||||
|
|
||||||
Err error;
|
Err error;
|
||||||
Char nameP[256];
|
Char nameP[256];
|
||||||
FileInfoType desc;
|
FileInfoType desc;
|
||||||
|
@ -197,7 +197,7 @@ bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while (dirIterator != expIteratorStop) {
|
while (dirIterator != expIteratorStop) {
|
||||||
error = VFSDirEntryEnumerate(handle, &dirIterator, &desc);
|
error = VFSDirEntryEnumerate(handle, &dirIterator, &desc);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
@ -212,11 +212,11 @@ bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo
|
||||||
|
|
||||||
AbstractFilesystemNode *PalmOSFilesystemNode::getParent() const {
|
AbstractFilesystemNode *PalmOSFilesystemNode::getParent() const {
|
||||||
PalmOSFilesystemNode *p = 0;
|
PalmOSFilesystemNode *p = 0;
|
||||||
|
|
||||||
if (!_isPseudoRoot) {
|
if (!_isPseudoRoot) {
|
||||||
const char *start = _path.c_str();
|
const char *start = _path.c_str();
|
||||||
const char *end = lastPathComponent(_path);
|
const char *end = lastPathComponent(_path);
|
||||||
|
|
||||||
p = new PalmOSFilesystemNode();
|
p = new PalmOSFilesystemNode();
|
||||||
p->_path = String(start, end - start);
|
p->_path = String(start, end - start);
|
||||||
p->_isValid = true;
|
p->_isValid = true;
|
||||||
|
@ -224,7 +224,7 @@ AbstractFilesystemNode *PalmOSFilesystemNode::getParent() const {
|
||||||
p->_displayName = lastPathComponent(p->_path);
|
p->_displayName = lastPathComponent(p->_path);
|
||||||
p->_isPseudoRoot =(p->_path == "/");
|
p->_isPseudoRoot =(p->_path == "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates POSIXFilesystemNode objects.
|
* Creates POSIXFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class POSIXFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<POSIXFilesystemFactory> {
|
class POSIXFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<POSIXFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
POSIXFilesystemFactory() {};
|
POSIXFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on POSIX.
|
* Implementation of the ScummVM file system API based on POSIX.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class POSIXFilesystemNode : public AbstractFilesystemNode {
|
class POSIXFilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -52,15 +52,15 @@ public:
|
||||||
* Creates a POSIXFilesystemNode with the root node as path.
|
* Creates a POSIXFilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
POSIXFilesystemNode();
|
POSIXFilesystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a POSIXFilesystemNode for a given path.
|
* Creates a POSIXFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
* @param verify true if the isValid and isDirectory flags should be verified during the construction.
|
* @param verify true if the isValid and isDirectory flags should be verified during the construction.
|
||||||
*/
|
*/
|
||||||
POSIXFilesystemNode(const String &path, bool verify);
|
POSIXFilesystemNode(const String &path, bool verify);
|
||||||
|
|
||||||
virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; }
|
virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; }
|
||||||
virtual String getDisplayName() const { return _displayName; }
|
virtual String getDisplayName() const { return _displayName; }
|
||||||
virtual String getName() const { return _displayName; }
|
virtual String getName() const { return _displayName; }
|
||||||
|
@ -68,11 +68,11 @@ public:
|
||||||
virtual bool isDirectory() const { return _isDirectory; }
|
virtual bool isDirectory() const { return _isDirectory; }
|
||||||
virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
|
virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; }
|
||||||
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
|
virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; }
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *getChild(const String &n) const;
|
virtual AbstractFilesystemNode *getChild(const String &n) const;
|
||||||
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
|
||||||
virtual AbstractFilesystemNode *getParent() const;
|
virtual AbstractFilesystemNode *getParent() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Tests and sets the _isValid and _isDirectory flags, using the stat() function.
|
* Tests and sets the _isValid and _isDirectory flags, using the stat() function.
|
||||||
|
@ -82,18 +82,18 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* /foo/bar.txt would return /bar.txt
|
* /foo/bar.txt would return /bar.txt
|
||||||
* /foo/bar/ would return /bar/
|
* /foo/bar/ would return /bar/
|
||||||
*
|
*
|
||||||
* @param str String containing the path.
|
* @param str String containing the path.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *start = str.c_str();
|
const char *start = str.c_str();
|
||||||
const char *cur = start + str.size() - 2;
|
const char *cur = start + str.size() - 2;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ const char *lastPathComponent(const Common::String &str) {
|
||||||
|
|
||||||
void POSIXFilesystemNode::setFlags() {
|
void POSIXFilesystemNode::setFlags() {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
_isValid = (0 == stat(_path.c_str(), &st));
|
_isValid = (0 == stat(_path.c_str(), &st));
|
||||||
_isDirectory = _isValid ? S_ISDIR(st.st_mode) : false;
|
_isDirectory = _isValid ? S_ISDIR(st.st_mode) : false;
|
||||||
}
|
}
|
||||||
|
@ -146,18 +146,18 @@ AbstractFilesystemNode *POSIXFilesystemNode::getChild(const String &n) const {
|
||||||
// FIXME: Pretty lame implementation! We do no error checking to speak
|
// FIXME: Pretty lame implementation! We do no error checking to speak
|
||||||
// of, do not check if this is a special node, etc.
|
// of, do not check if this is a special node, etc.
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
String newPath(_path);
|
String newPath(_path);
|
||||||
if (_path.lastChar() != '/')
|
if (_path.lastChar() != '/')
|
||||||
newPath += '/';
|
newPath += '/';
|
||||||
newPath += n;
|
newPath += n;
|
||||||
|
|
||||||
return new POSIXFilesystemNode(newPath, true);
|
return new POSIXFilesystemNode(newPath, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
|
bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const {
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
DIR *dirp = opendir(_path.c_str());
|
DIR *dirp = opendir(_path.c_str());
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
|
||||||
/* TODO: d_type is not part of POSIX, so it might not be supported
|
/* TODO: d_type is not part of POSIX, so it might not be supported
|
||||||
* on some of our targets. For those systems where it isn't supported,
|
* on some of our targets. For those systems where it isn't supported,
|
||||||
* add this #elif case, which tries to use stat() instead.
|
* add this #elif case, which tries to use stat() instead.
|
||||||
*
|
*
|
||||||
* The d_type method is used to avoid costly recurrent stat() calls in big
|
* The d_type method is used to avoid costly recurrent stat() calls in big
|
||||||
* directories.
|
* directories.
|
||||||
*/
|
*/
|
||||||
|
@ -221,11 +221,11 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
|
||||||
|
|
||||||
if (entry._isDirectory)
|
if (entry._isDirectory)
|
||||||
entry._path += "/";
|
entry._path += "/";
|
||||||
|
|
||||||
myList.push_back(new POSIXFilesystemNode(entry));
|
myList.push_back(new POSIXFilesystemNode(entry));
|
||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates PS2FilesystemNode objects.
|
* Creates PS2FilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class Ps2FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> {
|
class Ps2FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Ps2FilesystemFactory() {};
|
Ps2FilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,7 @@ extern OSystem_PS2 *g_systemPs2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on the Ps2SDK.
|
* Implementation of the ScummVM file system API based on the Ps2SDK.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class Ps2FilesystemNode : public AbstractFilesystemNode {
|
class Ps2FilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -49,14 +49,14 @@ public:
|
||||||
* Creates a PS2FilesystemNode with the root node as path.
|
* Creates a PS2FilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
Ps2FilesystemNode();
|
Ps2FilesystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a PS2FilesystemNode for a given path.
|
* Creates a PS2FilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
*/
|
*/
|
||||||
Ps2FilesystemNode(const String &path);
|
Ps2FilesystemNode(const String &path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* @param str String containing the path.
|
* @param str String containing the path.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
|
@ -138,10 +138,10 @@ AbstractFilesystemNode *Ps2FilesystemNode::getChild(const String &n) const {
|
||||||
char listDir[256];
|
char listDir[256];
|
||||||
sprintf(listDir, "%s/", _path.c_str());
|
sprintf(listDir, "%s/", _path.c_str());
|
||||||
int fd = fio.dopen(listDir);
|
int fd = fio.dopen(listDir);
|
||||||
|
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
iox_dirent_t dirent;
|
iox_dirent_t dirent;
|
||||||
|
|
||||||
while (fio.dread(fd, &dirent) > 0) {
|
while (fio.dread(fd, &dirent) > 0) {
|
||||||
if (strcmp(n.c_str(), dirent.name) == 0) {
|
if (strcmp(n.c_str(), dirent.name) == 0) {
|
||||||
Ps2FilesystemNode *dirEntry = new Ps2FilesystemNode();
|
Ps2FilesystemNode *dirEntry = new Ps2FilesystemNode();
|
||||||
|
@ -161,13 +161,13 @@ AbstractFilesystemNode *Ps2FilesystemNode::getChild(const String &n) const {
|
||||||
}
|
}
|
||||||
fio.dclose(fd);
|
fio.dclose(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const {
|
bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const {
|
||||||
//TODO: honor the hidden flag
|
//TODO: honor the hidden flag
|
||||||
|
|
||||||
if (!_isDirectory)
|
if (!_isDirectory)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -194,14 +194,14 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
|
||||||
} else {
|
} else {
|
||||||
char listDir[256];
|
char listDir[256];
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (_path.lastChar() == '/')
|
if (_path.lastChar() == '/')
|
||||||
fd = fio.dopen(_path.c_str());
|
fd = fio.dopen(_path.c_str());
|
||||||
else {
|
else {
|
||||||
sprintf(listDir, "%s/", _path.c_str());
|
sprintf(listDir, "%s/", _path.c_str());
|
||||||
fd = fio.dopen(listDir);
|
fd = fio.dopen(listDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
iox_dirent_t dirent;
|
iox_dirent_t dirent;
|
||||||
Ps2FilesystemNode dirEntry;
|
Ps2FilesystemNode dirEntry;
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates PSPFilesystemNode objects.
|
* Creates PSPFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class PSPFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PSPFilesystemFactory> {
|
class PSPFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PSPFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PSPFilesystemFactory() {};
|
PSPFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on PSPSDK API.
|
* Implementation of the ScummVM file system API based on PSPSDK API.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class PSPFilesystemNode : public AbstractFilesystemNode {
|
class PSPFilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -43,16 +43,16 @@ protected:
|
||||||
String _path;
|
String _path;
|
||||||
bool _isDirectory;
|
bool _isDirectory;
|
||||||
bool _isValid;
|
bool _isValid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Creates a PSPFilesystemNode with the root node as path.
|
* Creates a PSPFilesystemNode with the root node as path.
|
||||||
*/
|
*/
|
||||||
PSPFilesystemNode();
|
PSPFilesystemNode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a PSPFilesystemNode for a given path.
|
* Creates a PSPFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
* @param verify true if the isValid and isDirectory flags should be verified during the construction.
|
* @param verify true if the isValid and isDirectory flags should be verified during the construction.
|
||||||
*/
|
*/
|
||||||
|
@ -73,18 +73,18 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* /foo/bar.txt would return /bar.txt
|
* /foo/bar.txt would return /bar.txt
|
||||||
* /foo/bar/ would return /bar/
|
* /foo/bar/ would return /bar/
|
||||||
*
|
*
|
||||||
* @param str String containing the path.
|
* @param str String containing the path.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *start = str.c_str();
|
const char *start = str.c_str();
|
||||||
const char *cur = start + str.size() - 2;
|
const char *cur = start + str.size() - 2;
|
||||||
|
|
||||||
|
@ -104,24 +104,24 @@ PSPFilesystemNode::PSPFilesystemNode() {
|
||||||
|
|
||||||
PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {
|
PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {
|
||||||
assert(p.size() > 0);
|
assert(p.size() > 0);
|
||||||
|
|
||||||
_path = p;
|
_path = p;
|
||||||
_displayName = lastPathComponent(_path);
|
_displayName = lastPathComponent(_path);
|
||||||
_isValid = true;
|
_isValid = true;
|
||||||
_isDirectory = true;
|
_isDirectory = true;
|
||||||
|
|
||||||
if (verify) {
|
if (verify) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
_isValid = (0 == stat(_path.c_str(), &st));
|
_isValid = (0 == stat(_path.c_str(), &st));
|
||||||
_isDirectory = S_ISDIR(st.st_mode);
|
_isDirectory = S_ISDIR(st.st_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractFilesystemNode *PSPFilesystemNode::getChild(const String &n) const {
|
AbstractFilesystemNode *PSPFilesystemNode::getChild(const String &n) const {
|
||||||
// FIXME: Pretty lame implementation! We do no error checking to speak
|
// FIXME: Pretty lame implementation! We do no error checking to speak
|
||||||
// of, do not check if this is a special node, etc.
|
// of, do not check if this is a special node, etc.
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
String newPath(_path);
|
String newPath(_path);
|
||||||
if (_path.lastChar() != '/')
|
if (_path.lastChar() != '/')
|
||||||
newPath += '/';
|
newPath += '/';
|
||||||
|
@ -137,30 +137,30 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
|
||||||
|
|
||||||
int dfd = sceIoDopen(_path.c_str());
|
int dfd = sceIoDopen(_path.c_str());
|
||||||
if (dfd > 0) {
|
if (dfd > 0) {
|
||||||
SceIoDirent dir;
|
SceIoDirent dir;
|
||||||
memset(&dir, 0, sizeof(dir));
|
memset(&dir, 0, sizeof(dir));
|
||||||
|
|
||||||
while (sceIoDread(dfd, &dir) > 0) {
|
while (sceIoDread(dfd, &dir) > 0) {
|
||||||
// Skip 'invisible files
|
// Skip 'invisible files
|
||||||
if (dir.d_name[0] == '.')
|
if (dir.d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PSPFilesystemNode entry;
|
PSPFilesystemNode entry;
|
||||||
|
|
||||||
entry._isValid = true;
|
entry._isValid = true;
|
||||||
entry._displayName = dir.d_name;
|
entry._displayName = dir.d_name;
|
||||||
entry._path = _path;
|
entry._path = _path;
|
||||||
entry._path += dir.d_name;
|
entry._path += dir.d_name;
|
||||||
entry._isDirectory = dir.d_stat.st_attr & FIO_SO_IFDIR;
|
entry._isDirectory = dir.d_stat.st_attr & FIO_SO_IFDIR;
|
||||||
|
|
||||||
if (entry._isDirectory)
|
if (entry._isDirectory)
|
||||||
entry._path += "/";
|
entry._path += "/";
|
||||||
|
|
||||||
// Honor the chosen mode
|
// Honor the chosen mode
|
||||||
if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) ||
|
if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) ||
|
||||||
(mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory))
|
(mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
myList.push_back(new PSPFilesystemNode(entry));
|
myList.push_back(new PSPFilesystemNode(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,10 +174,10 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
|
||||||
AbstractFilesystemNode *PSPFilesystemNode::getParent() const {
|
AbstractFilesystemNode *PSPFilesystemNode::getParent() const {
|
||||||
if (_path == ROOT_PATH)
|
if (_path == ROOT_PATH)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const char *start = _path.c_str();
|
const char *start = _path.c_str();
|
||||||
const char *end = lastPathComponent(_path);
|
const char *end = lastPathComponent(_path);
|
||||||
|
|
||||||
return new PSPFilesystemNode(String(start, end - start), false);
|
return new PSPFilesystemNode(String(start, end - start), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates SymbianFilesystemNode objects.
|
* Creates SymbianFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class SymbianFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<SymbianFilesystemFactory> {
|
class SymbianFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<SymbianFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SymbianFilesystemFactory() {};
|
SymbianFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined (__SYMBIAN32__)
|
#if defined (__SYMBIAN32__)
|
||||||
#include "backends/fs/abstract-fs.h"
|
#include "backends/fs/abstract-fs.h"
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the ScummVM file system API based on POSIX.
|
* Implementation of the ScummVM file system API based on POSIX.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemNode.
|
||||||
*/
|
*/
|
||||||
class SymbianFilesystemNode : public AbstractFilesystemNode {
|
class SymbianFilesystemNode : public AbstractFilesystemNode {
|
||||||
|
@ -46,19 +46,19 @@ protected:
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Creates a SymbianFilesystemNode with the root node as path.
|
* Creates a SymbianFilesystemNode with the root node as path.
|
||||||
*
|
*
|
||||||
* @param aIsRoot true if the node will be a pseudo root, false otherwise.
|
* @param aIsRoot true if the node will be a pseudo root, false otherwise.
|
||||||
*/
|
*/
|
||||||
SymbianFilesystemNode(bool aIsRoot);
|
SymbianFilesystemNode(bool aIsRoot);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a SymbianFilesystemNode for a given path.
|
* Creates a SymbianFilesystemNode for a given path.
|
||||||
*
|
*
|
||||||
* @param path String with the path the new node should point to.
|
* @param path String with the path the new node should point to.
|
||||||
*/
|
*/
|
||||||
SymbianFilesystemNode(const String &path);
|
SymbianFilesystemNode(const String &path);
|
||||||
|
|
||||||
virtual bool exists() const {
|
virtual bool exists() const {
|
||||||
TFileName fname;
|
TFileName fname;
|
||||||
TPtrC8 ptr((const unsigned char*)_path.c_str(),_path.size());
|
TPtrC8 ptr((const unsigned char*)_path.c_str(),_path.size());
|
||||||
fname.Copy(ptr);
|
fname.Copy(ptr);
|
||||||
|
@ -79,18 +79,18 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last component of a given path.
|
* Returns the last component of a given path.
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* c:\foo\bar.txt would return "\bar.txt"
|
* c:\foo\bar.txt would return "\bar.txt"
|
||||||
* c:\foo\bar\ would return "\bar\"
|
* c:\foo\bar\ would return "\bar\"
|
||||||
*
|
*
|
||||||
* @param str Path to obtain the last component from.
|
* @param str Path to obtain the last component from.
|
||||||
* @return Pointer to the first char of the last component inside str.
|
* @return Pointer to the first char of the last component inside str.
|
||||||
*/
|
*/
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *start = str.c_str();
|
const char *start = str.c_str();
|
||||||
const char *cur = start + str.size() - 2;
|
const char *cur = start + str.size() - 2;
|
||||||
|
|
||||||
|
@ -103,14 +103,14 @@ const char *lastPathComponent(const Common::String &str) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixes the path by changing all slashes to backslashes.
|
* Fixes the path by changing all slashes to backslashes.
|
||||||
*
|
*
|
||||||
* @param path String with the path to be fixed.
|
* @param path String with the path to be fixed.
|
||||||
*/
|
*/
|
||||||
static void fixFilePath(Common::String& path) {
|
static void fixFilePath(Common::String& path) {
|
||||||
TInt len = path.size();
|
TInt len = path.size();
|
||||||
|
|
||||||
for (TInt index = 0; index < len; index++) {
|
for (TInt index = 0; index < len; index++) {
|
||||||
if (path[index] == '/') {
|
if (path[index] == '/') {
|
||||||
path[index] = '\\';
|
path[index] = '\\';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(const String &path) {
|
||||||
_isPseudoRoot = false;
|
_isPseudoRoot = false;
|
||||||
|
|
||||||
_path = path;
|
_path = path;
|
||||||
|
|
||||||
fixFilePath(_path);
|
fixFilePath(_path);
|
||||||
|
|
||||||
_displayName = lastPathComponent(_path);
|
_displayName = lastPathComponent(_path);
|
||||||
|
@ -184,27 +184,27 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
TVolumeInfo volumeInfo;
|
TVolumeInfo volumeInfo;
|
||||||
TBuf8<30> driveLabel8;
|
TBuf8<30> driveLabel8;
|
||||||
TBuf8<30> driveString8;
|
TBuf8<30> driveString8;
|
||||||
|
|
||||||
for (driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++) {
|
for (driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++) {
|
||||||
TInt err = fs.Volume(volumeInfo, driveNumber);
|
TInt err = fs.Volume(volumeInfo, driveNumber);
|
||||||
if (err != KErrNone)
|
if (err != KErrNone)
|
||||||
continue;
|
continue;
|
||||||
if (fs.DriveToChar(driveNumber,driveLetter) != KErrNone)
|
if (fs.DriveToChar(driveNumber,driveLetter) != KErrNone)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
driveLetterValue = driveLetter;
|
driveLetterValue = driveLetter;
|
||||||
|
|
||||||
if (volumeInfo.iName.Length() > 0) {
|
if (volumeInfo.iName.Length() > 0) {
|
||||||
driveLabel8.Copy(volumeInfo.iName); // 16 to 8bit des // enabling this line alone gives KERN-EXEC 3 with non-optimized GCC? WHY? grrr
|
driveLabel8.Copy(volumeInfo.iName); // 16 to 8bit des // enabling this line alone gives KERN-EXEC 3 with non-optimized GCC? WHY? grrr
|
||||||
driveString8.Format(_L8("Drive %c: (%S)"), driveLetterValue, &driveLabel8);
|
driveString8.Format(_L8("Drive %c: (%S)"), driveLetterValue, &driveLabel8);
|
||||||
} else {
|
} else {
|
||||||
driveString8.Format(_L8("Drive %c:"), driveLetterValue);
|
driveString8.Format(_L8("Drive %c:"), driveLetterValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
char path[10];
|
char path[10];
|
||||||
sprintf(path,"%c:\\", driveNumber+'A');
|
sprintf(path,"%c:\\", driveNumber+'A');
|
||||||
|
|
||||||
SymbianFilesystemNode entry(false);
|
SymbianFilesystemNode entry(false);
|
||||||
entry._displayName = (char*)driveString8.PtrZ(); // drive_name
|
entry._displayName = (char*)driveString8.PtrZ(); // drive_name
|
||||||
entry._isDirectory = true;
|
entry._isDirectory = true;
|
||||||
entry._isValid = true;
|
entry._isValid = true;
|
||||||
|
@ -226,17 +226,17 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
nameBuf.Copy(fileentry.iName);
|
nameBuf.Copy(fileentry.iName);
|
||||||
SymbianFilesystemNode entry(false);
|
SymbianFilesystemNode entry(false);
|
||||||
entry._isPseudoRoot = false;
|
entry._isPseudoRoot = false;
|
||||||
|
|
||||||
entry._displayName =(char*)nameBuf.PtrZ();
|
entry._displayName =(char*)nameBuf.PtrZ();
|
||||||
entry._path = _path;
|
entry._path = _path;
|
||||||
entry._path +=(char*)nameBuf.PtrZ();
|
entry._path +=(char*)nameBuf.PtrZ();
|
||||||
entry._isDirectory = fileentry.IsDir();
|
entry._isDirectory = fileentry.IsDir();
|
||||||
|
|
||||||
// Honor the chosen mode
|
// Honor the chosen mode
|
||||||
if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) ||
|
if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) ||
|
||||||
(mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory))
|
(mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (entry._isDirectory)
|
if (entry._isDirectory)
|
||||||
entry._path += "\\";
|
entry._path += "\\";
|
||||||
myList.push_back(new SymbianFilesystemNode(entry));
|
myList.push_back(new SymbianFilesystemNode(entry));
|
||||||
|
@ -244,7 +244,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b
|
||||||
CleanupStack::PopAndDestroy(dirPtr);
|
CleanupStack::PopAndDestroy(dirPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ AbstractFilesystemNode *SymbianFilesystemNode::getParent() const {
|
||||||
{
|
{
|
||||||
p = new SymbianFilesystemNode(true);
|
p = new SymbianFilesystemNode(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,20 +30,20 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates WindowsFilesystemNode objects.
|
* Creates WindowsFilesystemNode objects.
|
||||||
*
|
*
|
||||||
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
* Parts of this class are documented in the base interface class, AbstractFilesystemFactory.
|
||||||
*/
|
*/
|
||||||
class WindowsFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<WindowsFilesystemFactory> {
|
class WindowsFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<WindowsFilesystemFactory> {
|
||||||
public:
|
public:
|
||||||
typedef Common::String String;
|
typedef Common::String String;
|
||||||
|
|
||||||
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
virtual AbstractFilesystemNode *makeRootFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const;
|
||||||
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WindowsFilesystemFactory() {};
|
WindowsFilesystemFactory() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Common::Singleton<SingletonBaseType>;
|
friend class Common::Singleton<SingletonBaseType>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -141,7 +141,7 @@ private:
|
||||||
const char *lastPathComponent(const Common::String &str) {
|
const char *lastPathComponent(const Common::String &str) {
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *start = str.c_str();
|
const char *start = str.c_str();
|
||||||
const char *cur = start + str.size() - 2;
|
const char *cur = start + str.size() - 2;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*
|
*
|
||||||
* $URL:
|
* $URL:$
|
||||||
* $Id: dmedia.cpp
|
* $Id: dmedia.cpp$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
* some code liberated from seq.cpp and coremidi.cpp
|
* some code liberated from seq.cpp and coremidi.cpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(IRIX)
|
#if defined(IRIX)
|
||||||
|
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "sound/mpu401.h"
|
#include "sound/mpu401.h"
|
||||||
|
@ -86,7 +86,7 @@ int MidiDriver_DMEDIA::open() {
|
||||||
if (getenv("SCUMMVM_MIDIPORT")) {
|
if (getenv("SCUMMVM_MIDIPORT")) {
|
||||||
_deviceNum = atoi(getenv("SCUMMVM_MIDIPORT"));
|
_deviceNum = atoi(getenv("SCUMMVM_MIDIPORT"));
|
||||||
_midiportName = mdGetName(_deviceNum);
|
_midiportName = mdGetName(_deviceNum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_midiportName = mdGetName(0);
|
_midiportName = mdGetName(0);
|
||||||
|
|
|
@ -168,7 +168,7 @@ int MidiDriver_TIMIDITY::open() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* should read greeting issued by server upon connect:
|
/* should read greeting issued by server upon connect:
|
||||||
* "220 TiMidity++ v2.13.2 ready)" */
|
* "220 TiMidity++ v2.13.2 ready)" */
|
||||||
res = timidity_ctl_command(NULL);
|
res = timidity_ctl_command(NULL);
|
||||||
if (atoi(res) != 220) {
|
if (atoi(res) != 220) {
|
||||||
|
@ -178,7 +178,7 @@ int MidiDriver_TIMIDITY::open() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* setup buf and prepare data connection
|
* setup buf and prepare data connection
|
||||||
*/
|
*/
|
||||||
/* should read: "200 OK" */
|
/* should read: "200 OK" */
|
||||||
res = timidity_ctl_command("SETBUF %f %f", BUF_LOW_SYNC, BUF_HIGH_SYNC);
|
res = timidity_ctl_command("SETBUF %f %f", BUF_LOW_SYNC, BUF_HIGH_SYNC);
|
||||||
|
@ -200,7 +200,7 @@ int MidiDriver_TIMIDITY::open() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* open data connection
|
* open data connection
|
||||||
*/
|
*/
|
||||||
data_port = atoi(res + 4);
|
data_port = atoi(res + 4);
|
||||||
if ((_data_fd = connect_to_server(timidity_host, data_port)) < 0) {
|
if ((_data_fd = connect_to_server(timidity_host, data_port)) < 0) {
|
||||||
|
|
|
@ -21,5 +21,5 @@ MODULE_OBJS := \
|
||||||
saves/compressed/compressed-saves.o \
|
saves/compressed/compressed-saves.o \
|
||||||
timer/default/default-timer.o
|
timer/default/default-timer.o
|
||||||
|
|
||||||
# Include common rules
|
# Include common rules
|
||||||
include $(srcdir)/rules.mk
|
include $(srcdir)/rules.mk
|
||||||
|
|
|
@ -208,7 +208,7 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
|
||||||
sy = -1;
|
sy = -1;
|
||||||
else if (keyCurrentState & _keyExtra.bitDown)
|
else if (keyCurrentState & _keyExtra.bitDown)
|
||||||
sy = +1;
|
sy = +1;
|
||||||
|
|
||||||
if (keyCurrentState & _keyExtra.bitLeft)
|
if (keyCurrentState & _keyExtra.bitLeft)
|
||||||
sx = -1;
|
sx = -1;
|
||||||
else if (keyCurrentState & _keyExtra.bitRight)
|
else if (keyCurrentState & _keyExtra.bitRight)
|
||||||
|
@ -222,7 +222,7 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
|
||||||
warpMouse(x, y);
|
warpMouse(x, y);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
|
||||||
k = Common::KEYCODE_RIGHT; break;
|
k = Common::KEYCODE_RIGHT; break;
|
||||||
case chrLeftArrow:
|
case chrLeftArrow:
|
||||||
k = Common::KEYCODE_LEFT; break;
|
k = Common::KEYCODE_LEFT; break;
|
||||||
|
|
||||||
// return
|
// return
|
||||||
case chrLineFeed:
|
case chrLineFeed:
|
||||||
case chrCarriageReturn:
|
case chrCarriageReturn:
|
||||||
|
@ -314,10 +314,10 @@ bool OSystem_PalmBase::pollEvent(Common::Event &event) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// prevent crash when alarm is raised
|
// prevent crash when alarm is raised
|
||||||
handled = ((ev.eType == keyDownEvent) &&
|
handled = ((ev.eType == keyDownEvent) &&
|
||||||
(ev.data.keyDown.modifiers & commandKeyMask) &&
|
(ev.data.keyDown.modifiers & commandKeyMask) &&
|
||||||
((ev.data.keyDown.chr == vchrAttnStateChanged) ||
|
((ev.data.keyDown.chr == vchrAttnStateChanged) ||
|
||||||
(ev.data.keyDown.chr == vchrAttnUnsnooze)));
|
(ev.data.keyDown.chr == vchrAttnUnsnooze)));
|
||||||
|
|
||||||
// graffiti strokes, auto-off, etc...
|
// graffiti strokes, auto-off, etc...
|
||||||
if (!handled)
|
if (!handled)
|
||||||
|
|
|
@ -99,7 +99,7 @@ void OSystem_PalmBase::setPalette(const byte *colors, uint start, uint num) {
|
||||||
base[i].r = colors[0];
|
base[i].r = colors[0];
|
||||||
base[i].g = colors[1];
|
base[i].g = colors[1];
|
||||||
base[i].b = colors[2];
|
base[i].b = colors[2];
|
||||||
|
|
||||||
extras_palette(i + start, colors[0], colors[1], colors[2]);
|
extras_palette(i + start, colors[0], colors[1], colors[2]);
|
||||||
colors += 4;
|
colors += 4;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ void OSystem_PalmBase::setShakePos(int shakeOffset) {
|
||||||
|
|
||||||
void OSystem_PalmBase::updateScreen() {
|
void OSystem_PalmBase::updateScreen() {
|
||||||
// Check whether the palette was changed in the meantime and update the
|
// Check whether the palette was changed in the meantime and update the
|
||||||
// screen surface accordingly.
|
// screen surface accordingly.
|
||||||
if (_paletteDirtyEnd != 0 && _setPalette) {
|
if (_paletteDirtyEnd != 0 && _setPalette) {
|
||||||
WinSetDrawWindow(WinGetDisplayWindow());
|
WinSetDrawWindow(WinGetDisplayWindow());
|
||||||
WinPalette(winPaletteSet, _paletteDirtyStart, _paletteDirtyEnd - _paletteDirtyStart, _currentPalette + _paletteDirtyStart);
|
WinPalette(winPaletteSet, _paletteDirtyStart, _paletteDirtyEnd - _paletteDirtyStart, _currentPalette + _paletteDirtyStart);
|
||||||
|
|
|
@ -54,10 +54,10 @@ void OSystem_PalmBase::setMouseCursor(const byte *buf, uint w, uint h, int hotsp
|
||||||
if (_mouseCurState.w != w || _mouseCurState.h != h) {
|
if (_mouseCurState.w != w || _mouseCurState.h != h) {
|
||||||
_mouseCurState.w = w;
|
_mouseCurState.w = w;
|
||||||
_mouseCurState.h = h;
|
_mouseCurState.h = h;
|
||||||
|
|
||||||
if (_mouseDataP)
|
if (_mouseDataP)
|
||||||
free(_mouseDataP);
|
free(_mouseDataP);
|
||||||
|
|
||||||
if (_mouseBackupP)
|
if (_mouseBackupP)
|
||||||
free(_mouseBackupP);
|
free(_mouseBackupP);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ void OSystem_PalmBase::simulate_mouse(Common::Event &event, Int8 iHoriz, Int8 iV
|
||||||
x = (x >= _screenWidth ) ? _screenWidth - 1 : x;
|
x = (x >= _screenWidth ) ? _screenWidth - 1 : x;
|
||||||
y = (y < 0 ) ? 0 : y;
|
y = (y < 0 ) ? 0 : y;
|
||||||
y = (y >= _screenHeight ) ? _screenHeight - 1 : y;
|
y = (y >= _screenHeight ) ? _screenHeight - 1 : y;
|
||||||
|
|
||||||
*xr = x;
|
*xr = x;
|
||||||
*yr = y;
|
*yr = y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,13 +45,13 @@ OSystem_PalmBase::OSystem_PalmBase() {
|
||||||
_mode = _setMode;
|
_mode = _setMode;
|
||||||
_redawOSD = false;
|
_redawOSD = false;
|
||||||
_setPalette = true;
|
_setPalette = true;
|
||||||
|
|
||||||
_offScreenH = NULL;
|
_offScreenH = NULL;
|
||||||
_screenH = NULL;
|
_screenH = NULL;
|
||||||
_offScreenP = NULL;
|
_offScreenP = NULL;
|
||||||
_screenP = NULL;
|
_screenP = NULL;
|
||||||
_screenPitch = gVars->screenPitch;
|
_screenPitch = gVars->screenPitch;
|
||||||
|
|
||||||
_wasKey = false;
|
_wasKey = false;
|
||||||
_lastKeyModifier = kModifierNone;
|
_lastKeyModifier = kModifierNone;
|
||||||
_lastKeyRepeat = 100;
|
_lastKeyRepeat = 100;
|
||||||
|
@ -59,11 +59,11 @@ OSystem_PalmBase::OSystem_PalmBase() {
|
||||||
_showBatLow = false;
|
_showBatLow = false;
|
||||||
_batCheckTicks = SysTicksPerSecond() * 15;
|
_batCheckTicks = SysTicksPerSecond() * 15;
|
||||||
_batCheckLast = TimGetTicks();
|
_batCheckLast = TimGetTicks();
|
||||||
|
|
||||||
_saveMgr = 0;
|
_saveMgr = 0;
|
||||||
_timerMgr = 0;
|
_timerMgr = 0;
|
||||||
_mixerMgr = 0;
|
_mixerMgr = 0;
|
||||||
|
|
||||||
_mouseDataP = NULL;
|
_mouseDataP = NULL;
|
||||||
_mouseBackupP = NULL;
|
_mouseBackupP = NULL;
|
||||||
_mouseVisible = false;
|
_mouseVisible = false;
|
||||||
|
@ -73,7 +73,7 @@ OSystem_PalmBase::OSystem_PalmBase() {
|
||||||
MemSet(&_mouseOldState, sizeof(_mouseOldState), 0);
|
MemSet(&_mouseOldState, sizeof(_mouseOldState), 0);
|
||||||
MemSet(&_timer, sizeof(TimerType), 0);
|
MemSet(&_timer, sizeof(TimerType), 0);
|
||||||
MemSet(&_sound, sizeof(SoundType), 0);
|
MemSet(&_sound, sizeof(SoundType), 0);
|
||||||
|
|
||||||
_keyExtraRepeat = 0;
|
_keyExtraRepeat = 0;
|
||||||
_keyExtraPressed = 0;
|
_keyExtraPressed = 0;
|
||||||
_keyExtraDelay = (gVars->arrowKeys) ? computeMsecs(125) : computeMsecs(25);
|
_keyExtraDelay = (gVars->arrowKeys) ? computeMsecs(125) : computeMsecs(25);
|
||||||
|
@ -136,7 +136,7 @@ void OSystem_PalmBase::setTimerCallback(TimerProc callback, int timer) {
|
||||||
_timer.duration = timer;
|
_timer.duration = timer;
|
||||||
_timer.nextExpiry = getMillis() + timer;
|
_timer.nextExpiry = getMillis() + timer;
|
||||||
_timer.callback = callback;
|
_timer.callback = callback;
|
||||||
_timer.active = true;
|
_timer.active = true;
|
||||||
} else {
|
} else {
|
||||||
_timer.active = false;
|
_timer.active = false;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ void OSystem_PalmBase::quit() {
|
||||||
delete _saveMgr;
|
delete _saveMgr;
|
||||||
delete _timerMgr;
|
delete _timerMgr;
|
||||||
delete _mixerMgr;
|
delete _mixerMgr;
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ typedef struct {
|
||||||
class OSystem_PalmBase : public OSystem {
|
class OSystem_PalmBase : public OSystem {
|
||||||
private:
|
private:
|
||||||
virtual void int_initBackend() { }
|
virtual void int_initBackend() { }
|
||||||
|
|
||||||
virtual const GraphicsMode *int_getSupportedGraphicsModes() const;
|
virtual const GraphicsMode *int_getSupportedGraphicsModes() const;
|
||||||
virtual void int_updateScreen() = 0;
|
virtual void int_updateScreen() = 0;
|
||||||
virtual void int_initSize(uint w, uint h) = 0;
|
virtual void int_initSize(uint w, uint h) = 0;
|
||||||
|
@ -104,9 +104,9 @@ private:
|
||||||
|
|
||||||
virtual void draw_mouse() = 0;
|
virtual void draw_mouse() = 0;
|
||||||
virtual void undraw_mouse() = 0;
|
virtual void undraw_mouse() = 0;
|
||||||
|
|
||||||
virtual bool check_event(Common::Event &event, EventPtr ev) = 0;
|
virtual bool check_event(Common::Event &event, EventPtr ev) = 0;
|
||||||
|
|
||||||
virtual void timer_handler();
|
virtual void timer_handler();
|
||||||
void battery_handler();
|
void battery_handler();
|
||||||
virtual void get_coordinates(EventPtr ev, Coord &x, Coord &y) = 0;
|
virtual void get_coordinates(EventPtr ev, Coord &x, Coord &y) = 0;
|
||||||
|
@ -134,12 +134,12 @@ protected:
|
||||||
|
|
||||||
RGBColorType _currentPalette[256];
|
RGBColorType _currentPalette[256];
|
||||||
uint _paletteDirtyStart, _paletteDirtyEnd;
|
uint _paletteDirtyStart, _paletteDirtyEnd;
|
||||||
|
|
||||||
int _mode, _setMode;
|
int _mode, _setMode;
|
||||||
int16 _screenWidth, _screenHeight;
|
int16 _screenWidth, _screenHeight;
|
||||||
Boolean _modeChanged, _gfxLoaded;
|
Boolean _modeChanged, _gfxLoaded;
|
||||||
UInt32 _screenPitch;
|
UInt32 _screenPitch;
|
||||||
|
|
||||||
PointType _screenOffset;
|
PointType _screenOffset;
|
||||||
struct {
|
struct {
|
||||||
Coord w, h;
|
Coord w, h;
|
||||||
|
@ -162,7 +162,7 @@ protected:
|
||||||
UInt32 bitActionA; // left mouse button
|
UInt32 bitActionA; // left mouse button
|
||||||
UInt32 bitActionB; // right mouse button
|
UInt32 bitActionB; // right mouse button
|
||||||
} _keyExtra;
|
} _keyExtra;
|
||||||
|
|
||||||
bool _mouseVisible;
|
bool _mouseVisible;
|
||||||
bool _mouseDrawn;
|
bool _mouseDrawn;
|
||||||
MousePos _mouseCurState;
|
MousePos _mouseCurState;
|
||||||
|
@ -171,14 +171,14 @@ protected:
|
||||||
int16 _mouseHotspotY;
|
int16 _mouseHotspotY;
|
||||||
byte _mouseKeyColor;
|
byte _mouseKeyColor;
|
||||||
byte *_mouseDataP, *_mouseBackupP;
|
byte *_mouseDataP, *_mouseBackupP;
|
||||||
|
|
||||||
|
|
||||||
bool _wasKey;
|
bool _wasKey;
|
||||||
UInt8 _lastKeyModifier;
|
UInt8 _lastKeyModifier;
|
||||||
UInt32 _lastKeyRepeat;
|
UInt32 _lastKeyRepeat;
|
||||||
Boolean _useNumPad, _showBatLow;
|
Boolean _useNumPad, _showBatLow;
|
||||||
UInt32 _batCheckTicks, _batCheckLast;
|
UInt32 _batCheckTicks, _batCheckLast;
|
||||||
|
|
||||||
int _samplesPerSec;
|
int _samplesPerSec;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -190,19 +190,19 @@ public:
|
||||||
|
|
||||||
bool hasFeature(Feature f);
|
bool hasFeature(Feature f);
|
||||||
bool getFeatureState(Feature f);
|
bool getFeatureState(Feature f);
|
||||||
|
|
||||||
virtual void beginGFXTransaction();
|
virtual void beginGFXTransaction();
|
||||||
virtual void endGFXTransaction();
|
virtual void endGFXTransaction();
|
||||||
|
|
||||||
virtual int16 getOverlayHeight();
|
virtual int16 getOverlayHeight();
|
||||||
virtual int16 getOverlayWidth();
|
virtual int16 getOverlayWidth();
|
||||||
|
|
||||||
virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b);
|
virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b);
|
||||||
virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b);
|
virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b);
|
||||||
|
|
||||||
virtual void setCursorPalette(const byte *colors, uint start, uint num);
|
virtual void setCursorPalette(const byte *colors, uint start, uint num);
|
||||||
virtual void disableCursorPalette(bool disable);
|
virtual void disableCursorPalette(bool disable);
|
||||||
|
|
||||||
virtual void displayMessageOnOSD(const char *msg);
|
virtual void displayMessageOnOSD(const char *msg);
|
||||||
*/
|
*/
|
||||||
const GraphicsMode *getSupportedGraphicsModes() const;
|
const GraphicsMode *getSupportedGraphicsModes() const;
|
||||||
|
@ -233,25 +233,25 @@ public:
|
||||||
void grabPalette(byte *colors, uint start, uint num);
|
void grabPalette(byte *colors, uint start, uint num);
|
||||||
virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) = 0;
|
virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b) = 0;
|
||||||
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) = 0;
|
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) = 0;
|
||||||
|
|
||||||
bool pollEvent(Common::Event &event);
|
bool pollEvent(Common::Event &event);
|
||||||
|
|
||||||
virtual uint32 getMillis();
|
virtual uint32 getMillis();
|
||||||
virtual void delayMillis(uint msecs);
|
virtual void delayMillis(uint msecs);
|
||||||
|
|
||||||
virtual void setTimerCallback(TimerProc callback, int interval);
|
virtual void setTimerCallback(TimerProc callback, int interval);
|
||||||
|
|
||||||
virtual MutexRef createMutex() { return NULL; }
|
virtual MutexRef createMutex() { return NULL; }
|
||||||
virtual void lockMutex(MutexRef mutex) {}
|
virtual void lockMutex(MutexRef mutex) {}
|
||||||
virtual void unlockMutex(MutexRef mutex) {}
|
virtual void unlockMutex(MutexRef mutex) {}
|
||||||
virtual void deleteMutex(MutexRef mutex) {}
|
virtual void deleteMutex(MutexRef mutex) {}
|
||||||
|
|
||||||
int getOutputSampleRate() const { return _samplesPerSec; }
|
int getOutputSampleRate() const { return _samplesPerSec; }
|
||||||
virtual Audio::Mixer *getMixer();
|
virtual Audio::Mixer *getMixer();
|
||||||
|
|
||||||
void quit();
|
void quit();
|
||||||
virtual void setWindowCaption(const char *caption) = 0;
|
virtual void setWindowCaption(const char *caption) = 0;
|
||||||
|
|
||||||
Common::SaveFileManager *getSavefileManager();
|
Common::SaveFileManager *getSavefileManager();
|
||||||
Common::TimerManager *getTimerManager();
|
Common::TimerManager *getTimerManager();
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
OSystem_PalmOS5::OSystem_PalmOS5() : OSystem_PalmBase() {
|
OSystem_PalmOS5::OSystem_PalmOS5() : OSystem_PalmBase() {
|
||||||
_sound.active = false;
|
_sound.active = false;
|
||||||
_setPalette = false;
|
_setPalette = false;
|
||||||
|
|
||||||
_workScreenH = NULL;
|
_workScreenH = NULL;
|
||||||
_overlayH = NULL;
|
_overlayH = NULL;
|
||||||
_isSwitchable = false;
|
_isSwitchable = false;
|
||||||
|
@ -67,9 +67,9 @@ void OSystem_PalmOS5::calc_rect(Boolean fullscreen) {
|
||||||
h = gVars->screenHeight * _screenHeight / _screenWidth;
|
h = gVars->screenHeight * _screenHeight / _screenWidth;
|
||||||
|
|
||||||
_screenOffset.x = 0;
|
_screenOffset.x = 0;
|
||||||
_screenOffset.y = (gVars->screenHeight - h) / 2;
|
_screenOffset.y = (gVars->screenHeight - h) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
_screenDest.w = w;
|
_screenDest.w = w;
|
||||||
_screenDest.h = h;
|
_screenDest.h = h;
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ private:
|
||||||
OverlayColor *_overlayP;
|
OverlayColor *_overlayP;
|
||||||
WinHandle _overlayH, _workScreenH;
|
WinHandle _overlayH, _workScreenH;
|
||||||
int16 *_workScreenP;
|
int16 *_workScreenP;
|
||||||
|
|
||||||
Boolean _isSwitchable, _wasRotated;
|
Boolean _isSwitchable, _wasRotated;
|
||||||
|
|
||||||
virtual void int_initBackend();
|
virtual void int_initBackend();
|
||||||
|
@ -183,7 +183,7 @@ public:
|
||||||
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
|
virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
|
||||||
virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
|
virtual OverlayColor RGBToColor(uint8 r, uint8 g, uint8 b);
|
||||||
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
|
virtual void colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b);
|
||||||
|
|
||||||
void setWindowCaption(const char *caption);
|
void setWindowCaption(const char *caption);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,7 +70,7 @@ void OSystem_PalmOS5Ex::setTimerCallback(TimerProc callback, int timer) {
|
||||||
} else {
|
} else {
|
||||||
_timer.active = false;
|
_timer.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_timer.active)
|
if (!_timer.active)
|
||||||
_timerEx.timerID = 0;
|
_timerEx.timerID = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ void OSystem_PalmZodiac::int_initBackend() {
|
||||||
_keyExtra.bitDown = keyBitRockerDown;
|
_keyExtra.bitDown = keyBitRockerDown;
|
||||||
_keyExtra.bitLeft = keyBitRockerLeft;
|
_keyExtra.bitLeft = keyBitRockerLeft;
|
||||||
_keyExtra.bitRight = keyBitRockerRight;
|
_keyExtra.bitRight = keyBitRockerRight;
|
||||||
|
|
||||||
// _keyExtra.bitActionA = keyBitActionD;
|
// _keyExtra.bitActionA = keyBitActionD;
|
||||||
// _keyExtra.bitActionB = keyBitActionB;
|
// _keyExtra.bitActionB = keyBitActionB;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ private:
|
||||||
TwGfxSurfaceType *_palmScreenP, *_tmpScreenP;
|
TwGfxSurfaceType *_palmScreenP, *_tmpScreenP;
|
||||||
TwGfxSurfaceType *_overlayP;
|
TwGfxSurfaceType *_overlayP;
|
||||||
Boolean _fullscreen;
|
Boolean _fullscreen;
|
||||||
|
|
||||||
TwGfxPointType _srcPos;
|
TwGfxPointType _srcPos;
|
||||||
TwGfxRectType _srcRect, _dstRect;
|
TwGfxRectType _srcRect, _dstRect;
|
||||||
TwGfxBitmapType _srcBmp;
|
TwGfxBitmapType _srcBmp;
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
OSystem_PalmZodiac();
|
OSystem_PalmZodiac();
|
||||||
|
|
||||||
static OSystem *create();
|
static OSystem *create();
|
||||||
|
|
||||||
void setFeatureState(Feature f, bool enable);
|
void setFeatureState(Feature f, bool enable);
|
||||||
|
|
||||||
int getDefaultGraphicsMode() const;
|
int getDefaultGraphicsMode() const;
|
||||||
|
|
|
@ -36,7 +36,7 @@ AeroCDPlayer::AeroCDPlayer(OSystem *sys) {
|
||||||
bool AeroCDPlayer::init() {
|
bool AeroCDPlayer::init() {
|
||||||
aeroplayer_Startup();
|
aeroplayer_Startup();
|
||||||
_isInitialized = aeroplayer_PlayerIsActive();
|
_isInitialized = aeroplayer_PlayerIsActive();
|
||||||
|
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
_volumeLimit = aeroplayer_GetMaxVolumeIndex();
|
_volumeLimit = aeroplayer_GetMaxVolumeIndex();
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ void AeroCDPlayer::setVolume(int volume) {
|
||||||
|
|
||||||
bool AeroCDPlayer::poll() {
|
bool AeroCDPlayer::poll() {
|
||||||
return
|
return
|
||||||
( _pckLoops != 0 &&
|
( _pckLoops != 0 &&
|
||||||
( getPosition() < _pckTrackEndFrame &&
|
( getPosition() < _pckTrackEndFrame &&
|
||||||
getStatus() == AEROPLAYER_STATUS_PLAY
|
getStatus() == AEROPLAYER_STATUS_PLAY
|
||||||
)
|
)
|
||||||
|
@ -107,7 +107,7 @@ void AeroCDPlayer::update() {
|
||||||
forceStop();
|
forceStop();
|
||||||
else {
|
else {
|
||||||
//_pckStopTime = 0;
|
//_pckStopTime = 0;
|
||||||
|
|
||||||
if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) {
|
if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) {
|
||||||
setPosition(0);
|
setPosition(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -136,10 +136,10 @@ void AeroCDPlayer::play(int track, int num_loops, int start_frame, int duration)
|
||||||
|
|
||||||
Char fileP[100];
|
Char fileP[100];
|
||||||
static const Char *ext[] = { "mp3", "ogg" };
|
static const Char *ext[] = { "mp3", "ogg" };
|
||||||
|
|
||||||
// if (duration > 0)
|
// if (duration > 0)
|
||||||
// duration += 5;
|
// duration += 5;
|
||||||
|
|
||||||
_pckTrack = track;
|
_pckTrack = track;
|
||||||
_pckLoops = num_loops;
|
_pckLoops = num_loops;
|
||||||
_pckTrackStartFrame = TO_MSECS(start_frame);
|
_pckTrackStartFrame = TO_MSECS(start_frame);
|
||||||
|
@ -149,7 +149,7 @@ void AeroCDPlayer::play(int track, int num_loops, int start_frame, int duration)
|
||||||
aeroplayer_Pause();
|
aeroplayer_Pause();
|
||||||
aeroplayer_PlayTrack(gVars->VFS.volRefNum, fileP);
|
aeroplayer_PlayTrack(gVars->VFS.volRefNum, fileP);
|
||||||
aeroplayer_Pause();
|
aeroplayer_Pause();
|
||||||
|
|
||||||
if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) {
|
if (_pckTrackStartFrame == 0 && _pckTrackDuration == 0) {
|
||||||
_pckTrackDuration = getDuration();
|
_pckTrackDuration = getDuration();
|
||||||
} else {
|
} else {
|
||||||
|
@ -157,7 +157,7 @@ void AeroCDPlayer::play(int track, int num_loops, int start_frame, int duration)
|
||||||
if (_pckTrackDuration == 0)
|
if (_pckTrackDuration == 0)
|
||||||
_pckTrackDuration = getDuration() - _pckTrackStartFrame;
|
_pckTrackDuration = getDuration() - _pckTrackStartFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
aeroplayer_Play();
|
aeroplayer_Play();
|
||||||
|
|
||||||
_pckStopTime = 0;
|
_pckStopTime = 0;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CD_AEROPLAYER_H
|
#ifndef CD_AEROPLAYER_H
|
||||||
#define CD_AEROPLAYER_H
|
#define CD_AEROPLAYER_H
|
||||||
|
|
||||||
|
@ -40,9 +40,9 @@ public:
|
||||||
void update();
|
void update();
|
||||||
void play(int track, int num_loops, int start_frame, int duration);
|
void play(int track, int num_loops, int start_frame, int duration);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void setVolume(int volume);
|
void setVolume(int volume);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OSystem *_sys;
|
OSystem *_sys;
|
||||||
Char gameP[15];
|
Char gameP[15];
|
||||||
|
|
|
@ -49,7 +49,7 @@ bool MsaCDPlayer::init() {
|
||||||
|
|
||||||
if (!(error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) {
|
if (!(error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) {
|
||||||
// not found with audio adapter ?!
|
// not found with audio adapter ?!
|
||||||
//if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) {
|
//if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrMsa) {
|
||||||
if ((error = SysLibFind(sonySysLibNameMsa, &_msaRefNum)))
|
if ((error = SysLibFind(sonySysLibNameMsa, &_msaRefNum)))
|
||||||
if (error == sysErrLibNotFound)
|
if (error == sysErrLibNotFound)
|
||||||
error = SysLibLoad(sonySysFileTMsaLib, sonySysFileCMsaLib, &_msaRefNum);
|
error = SysLibLoad(sonySysFileTMsaLib, sonySysFileCMsaLib, &_msaRefNum);
|
||||||
|
@ -59,11 +59,11 @@ bool MsaCDPlayer::init() {
|
||||||
// this doesn't work the same way on build-in MP3 device and external MP3 devices
|
// this doesn't work the same way on build-in MP3 device and external MP3 devices
|
||||||
if (!error) {
|
if (!error) {
|
||||||
//MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); // close the lib if we previously let it open (?) Need to add Notify for sonySysNotifyMsaEnforceOpenEvent just in case ...
|
//MsaLibClose(_msaRefNum, msaLibOpenModeAlbum); // close the lib if we previously let it open (?) Need to add Notify for sonySysNotifyMsaEnforceOpenEvent just in case ...
|
||||||
error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum);
|
error = MsaLibOpen(_msaRefNum, msaLibOpenModeAlbum);
|
||||||
|
|
||||||
//if (error == msaErrAlreadyOpen)
|
//if (error == msaErrAlreadyOpen)
|
||||||
// error = MsaLibEnforceOpen(_msaRefNum, msaLibOpenModeAlbum, appFileCreator);
|
// error = MsaLibEnforceOpen(_msaRefNum, msaLibOpenModeAlbum, appFileCreator);
|
||||||
|
|
||||||
//error = (error != msaErrStillOpen) ? error : errNone;
|
//error = (error != msaErrStillOpen) ? error : errNone;
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
|
@ -156,7 +156,7 @@ void MsaCDPlayer::update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
MsaStop(_msaRefNum, true);
|
MsaStop(_msaRefNum, true);
|
||||||
|
|
||||||
if (_msaLoops == 0)
|
if (_msaLoops == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -194,13 +194,13 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration)
|
||||||
|
|
||||||
if (!num_loops && !start_frame)
|
if (!num_loops && !start_frame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_msaTrack = track + gVars->CD.firstTrack - 1; // first track >= 1 ?, not 0 (0=album)
|
_msaTrack = track + gVars->CD.firstTrack - 1; // first track >= 1 ?, not 0 (0=album)
|
||||||
_msaLoops = num_loops;
|
_msaLoops = num_loops;
|
||||||
_msaStartFrame = TO_MSECS(start_frame);
|
_msaStartFrame = TO_MSECS(start_frame);
|
||||||
_msaDuration = TO_MSECS(duration);
|
_msaDuration = TO_MSECS(duration);
|
||||||
|
|
||||||
Err e;
|
Err e;
|
||||||
MemHandle trackH;
|
MemHandle trackH;
|
||||||
|
|
||||||
// stop current play if any
|
// stop current play if any
|
||||||
|
@ -215,19 +215,19 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration)
|
||||||
MsaTime msaTime;
|
MsaTime msaTime;
|
||||||
MsaTrackInfo *trackP;
|
MsaTrackInfo *trackP;
|
||||||
UInt32 SU, fullLength;
|
UInt32 SU, fullLength;
|
||||||
|
|
||||||
// FIXME (?) : this enable MsaSuToTime to return the right value in some cases
|
// FIXME (?) : this enable MsaSuToTime to return the right value in some cases
|
||||||
MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP);
|
MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP);
|
||||||
MsaStop(_msaRefNum, true);
|
MsaStop(_msaRefNum, true);
|
||||||
|
|
||||||
// get the msa time
|
// get the msa time
|
||||||
trackP = (MsaTrackInfo *)MemHandleLock(trackH);
|
trackP = (MsaTrackInfo *)MemHandleLock(trackH);
|
||||||
MsaSuToTime(_msaRefNum, trackP->totalsu, &msaTime);
|
MsaSuToTime(_msaRefNum, trackP->totalsu, &msaTime);
|
||||||
SU = trackP->totalsu;
|
SU = trackP->totalsu;
|
||||||
MemPtrUnlock(trackP);
|
MemPtrUnlock(trackP);
|
||||||
MemHandleFree(trackH);
|
MemHandleFree(trackH);
|
||||||
|
|
||||||
// MSA frame in milli-seconds
|
// MSA frame in milli-seconds
|
||||||
fullLength = FROM_MIN(msaTime.minute);
|
fullLength = FROM_MIN(msaTime.minute);
|
||||||
fullLength += FROM_SEC(msaTime.second);
|
fullLength += FROM_SEC(msaTime.second);
|
||||||
fullLength += msaTime.frame;
|
fullLength += msaTime.frame;
|
||||||
|
@ -240,7 +240,7 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration)
|
||||||
} else {
|
} else {
|
||||||
_msaTrackLength = fullLength;
|
_msaTrackLength = fullLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to play the track
|
// try to play the track
|
||||||
if (start_frame == 0 && duration == 0) {
|
if (start_frame == 0 && duration == 0) {
|
||||||
MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP);
|
MsaPlay(_msaRefNum, _msaTrack, 0, msa_PBRATE_SP);
|
||||||
|
@ -250,7 +250,7 @@ void MsaCDPlayer::play(int track, int num_loops, int start_frame, int duration)
|
||||||
_msaTrackStartSu = (UInt32) ((float)(_msaStartFrame) / ((float)fullLength / (float)SU));
|
_msaTrackStartSu = (UInt32) ((float)(_msaStartFrame) / ((float)fullLength / (float)SU));
|
||||||
_msaTrackEndSu = (UInt32) ((float)(_msaTrackLength) / ((float)fullLength / (float)SU));
|
_msaTrackEndSu = (UInt32) ((float)(_msaTrackLength) / ((float)fullLength / (float)SU));
|
||||||
_msaTrackEndSu += _msaTrackStartSu;
|
_msaTrackEndSu += _msaTrackStartSu;
|
||||||
|
|
||||||
if (_msaTrackEndSu > SU)
|
if (_msaTrackEndSu > SU)
|
||||||
_msaTrackEndSu = SU;
|
_msaTrackEndSu = SU;
|
||||||
|
|
||||||
|
|
|
@ -64,5 +64,5 @@ public:
|
||||||
UInt32 _msaTrackStartSu, _msaTrackEndSu;
|
UInt32 _msaTrackStartSu, _msaTrackEndSu;
|
||||||
UInt32 _msaTrackLength;
|
UInt32 _msaTrackLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,7 +37,7 @@ bool PckTunesCDPlayer::init() {
|
||||||
_isInitialized = PocketTunesIsRunning();
|
_isInitialized = PocketTunesIsRunning();
|
||||||
_isPlaying = false;
|
_isPlaying = false;
|
||||||
_pAction = NULL;
|
_pAction = NULL;
|
||||||
|
|
||||||
if (_isInitialized) {
|
if (_isInitialized) {
|
||||||
_pAction = (PocketTunesAction*)MemPtrNew(sizeof(PocketTunesAction));
|
_pAction = (PocketTunesAction*)MemPtrNew(sizeof(PocketTunesAction));
|
||||||
_volumeLimit = getVolumeLimit();
|
_volumeLimit = getVolumeLimit();
|
||||||
|
@ -64,12 +64,12 @@ UInt32 PckTunesCDPlayer::getVolumeLimit() {
|
||||||
|
|
||||||
_pAction->action = kPocketTunesActionGetValue;
|
_pAction->action = kPocketTunesActionGetValue;
|
||||||
_pAction->data.getValueAction.which = kPtunesValueMaxVolume;
|
_pAction->data.getValueAction.which = kPtunesValueMaxVolume;
|
||||||
|
|
||||||
EvtGetEvent(&_eAction, evtNoWait);
|
EvtGetEvent(&_eAction, evtNoWait);
|
||||||
if (PocketTunesCallSynch(_pAction) == errNone)
|
if (PocketTunesCallSynch(_pAction) == errNone)
|
||||||
value = _pAction->data.getValueAction.value;
|
value = _pAction->data.getValueAction.value;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt32 PckTunesCDPlayer::getStatus() {
|
UInt32 PckTunesCDPlayer::getStatus() {
|
||||||
|
@ -83,8 +83,8 @@ UInt32 PckTunesCDPlayer::getStatus() {
|
||||||
EvtGetEvent(&_eAction, evtNoWait);
|
EvtGetEvent(&_eAction, evtNoWait);
|
||||||
if (PocketTunesCallSynch(_pAction) == errNone)
|
if (PocketTunesCallSynch(_pAction) == errNone)
|
||||||
status = _pAction->data.getStatusAction.status;
|
status = _pAction->data.getStatusAction.status;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt32 PckTunesCDPlayer::getPosition(UInt32 deflt) {
|
UInt32 PckTunesCDPlayer::getPosition(UInt32 deflt) {
|
||||||
|
@ -95,7 +95,7 @@ UInt32 PckTunesCDPlayer::getPosition(UInt32 deflt) {
|
||||||
|
|
||||||
_pAction->action = kPocketTunesActionGetValue;
|
_pAction->action = kPocketTunesActionGetValue;
|
||||||
_pAction->data.getValueAction.which = kPtunesValueSongPosition;
|
_pAction->data.getValueAction.which = kPtunesValueSongPosition;
|
||||||
|
|
||||||
EvtGetEvent(&_eAction, evtNoWait);
|
EvtGetEvent(&_eAction, evtNoWait);
|
||||||
if (PocketTunesCallSynch(_pAction) == errNone)
|
if (PocketTunesCallSynch(_pAction) == errNone)
|
||||||
value = _pAction->data.getValueAction.value;
|
value = _pAction->data.getValueAction.value;
|
||||||
|
@ -111,12 +111,12 @@ UInt32 PckTunesCDPlayer::getDuration() {
|
||||||
|
|
||||||
_pAction->action = kPocketTunesActionGetValue;
|
_pAction->action = kPocketTunesActionGetValue;
|
||||||
_pAction->data.getValueAction.which = kPtunesValueSongDuration;
|
_pAction->data.getValueAction.which = kPtunesValueSongDuration;
|
||||||
|
|
||||||
EvtGetEvent(&_eAction, evtNoWait);
|
EvtGetEvent(&_eAction, evtNoWait);
|
||||||
if (PocketTunesCallSynch(_pAction) == errNone)
|
if (PocketTunesCallSynch(_pAction) == errNone)
|
||||||
value = _pAction->data.getValueAction.value;
|
value = _pAction->data.getValueAction.value;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PckTunesCDPlayer::setPosition(UInt32 value) {
|
void PckTunesCDPlayer::setPosition(UInt32 value) {
|
||||||
|
@ -203,16 +203,16 @@ void PckTunesCDPlayer::play(int track, int num_loops, int start_frame, int durat
|
||||||
EventType e;
|
EventType e;
|
||||||
Char nameP[256], fileP[100];
|
Char nameP[256], fileP[100];
|
||||||
static const Char *ext[] = { "mp3", "ogg" };
|
static const Char *ext[] = { "mp3", "ogg" };
|
||||||
|
|
||||||
_pckTrack = track;
|
_pckTrack = track;
|
||||||
_pckLoops = num_loops;
|
_pckLoops = num_loops;
|
||||||
_pckTrackStartFrame = TO_MSECS(start_frame);
|
_pckTrackStartFrame = TO_MSECS(start_frame);
|
||||||
_pckTrackDuration = TO_MSECS(duration);
|
_pckTrackDuration = TO_MSECS(duration);
|
||||||
|
|
||||||
VFSVolumeGetLabel(gVars->VFS.volRefNum, nameP, 256);
|
VFSVolumeGetLabel(gVars->VFS.volRefNum, nameP, 256);
|
||||||
|
|
||||||
StrPrintF(fileP, "/Palm/Programs/ScummVM/Audio/%s_%03ld.%s", gameP, (track + gVars->CD.firstTrack - 1), ext[gVars->CD.format]);
|
StrPrintF(fileP, "/Palm/Programs/ScummVM/Audio/%s_%03ld.%s", gameP, (track + gVars->CD.firstTrack - 1), ext[gVars->CD.format]);
|
||||||
|
|
||||||
if (PocketTunesOpenFile(nameP, fileP, 0) == errNone) {
|
if (PocketTunesOpenFile(nameP, fileP, 0) == errNone) {
|
||||||
EvtGetEvent(&e, evtNoWait);
|
EvtGetEvent(&e, evtNoWait);
|
||||||
PocketTunesPauseIfPlaying();
|
PocketTunesPauseIfPlaying();
|
||||||
|
|
|
@ -22,48 +22,48 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CD_POCKETTUNES_H
|
#ifndef CD_POCKETTUNES_H
|
||||||
#define CD_POCKETTUNES_H
|
#define CD_POCKETTUNES_H
|
||||||
|
|
||||||
#include "cdaudio.h"
|
#include "cdaudio.h"
|
||||||
#include "pockettunes.h"
|
#include "pockettunes.h"
|
||||||
|
|
||||||
class PckTunesCDPlayer : public CDAudio {
|
class PckTunesCDPlayer : public CDAudio {
|
||||||
public:
|
public:
|
||||||
PckTunesCDPlayer(OSystem *sys);
|
PckTunesCDPlayer(OSystem *sys);
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
void release();
|
void release();
|
||||||
|
|
||||||
bool poll();
|
bool poll();
|
||||||
void update();
|
void update();
|
||||||
void play(int track, int num_loops, int start_frame, int duration);
|
void play(int track, int num_loops, int start_frame, int duration);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void setVolume(int volume);
|
void setVolume(int volume);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OSystem *_sys;
|
OSystem *_sys;
|
||||||
Char gameP[15];
|
Char gameP[15];
|
||||||
|
|
||||||
PocketTunesAction *_pAction; // prevent memory fragmentation
|
PocketTunesAction *_pAction; // prevent memory fragmentation
|
||||||
EventType _eAction;
|
EventType _eAction;
|
||||||
|
|
||||||
UInt32 getStatus();
|
UInt32 getStatus();
|
||||||
void setPosition(UInt32 value);
|
void setPosition(UInt32 value);
|
||||||
UInt32 getDuration();
|
UInt32 getDuration();
|
||||||
UInt32 getPosition(UInt32 deft);
|
UInt32 getPosition(UInt32 deft);
|
||||||
|
|
||||||
UInt32 _volumeLimit;
|
UInt32 _volumeLimit;
|
||||||
UInt32 getVolumeLimit();
|
UInt32 getVolumeLimit();
|
||||||
|
|
||||||
Boolean _isPlaying;
|
Boolean _isPlaying;
|
||||||
// cdrom
|
// cdrom
|
||||||
UInt16 _pckLoops, _pckTrack;
|
UInt16 _pckLoops, _pckTrack;
|
||||||
UInt32 _pckTrackStartFrame, _pckTrackEndFrame;
|
UInt32 _pckTrackStartFrame, _pckTrackEndFrame;
|
||||||
UInt32 _pckStopTime, _pckTrackDuration;
|
UInt32 _pckStopTime, _pckTrackDuration;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CDAUDIO_H
|
#ifndef CDAUDIO_H
|
||||||
#define CDAUDIO_H
|
#define CDAUDIO_H
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
#define FROM_SEC(secs) ((UInt32)((secs) * 1000))
|
#define FROM_SEC(secs) ((UInt32)((secs) * 1000))
|
||||||
|
|
||||||
class CDAudio {
|
class CDAudio {
|
||||||
public:
|
public:
|
||||||
CDAudio() {
|
CDAudio() {
|
||||||
_isInitialized = false;
|
_isInitialized = false;
|
||||||
_volumeLevel = 100;
|
_volumeLevel = 100;
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
|
|
||||||
virtual bool init() = 0;
|
virtual bool init() = 0;
|
||||||
virtual void release() = 0;
|
virtual void release() = 0;
|
||||||
|
|
||||||
// OSystem functions
|
// OSystem functions
|
||||||
virtual bool poll() = 0;
|
virtual bool poll() = 0;
|
||||||
virtual void play(int track, int num_loops, int start_frame, int duration) = 0;
|
virtual void play(int track, int num_loops, int start_frame, int duration) = 0;
|
||||||
|
|
|
@ -43,7 +43,7 @@ void DrawStatus(Boolean show) {
|
||||||
if (OPTIONS_TST(kOptDisableOnScrDisp))
|
if (OPTIONS_TST(kOptDisableOnScrDisp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UInt8 x,y;
|
UInt8 x,y;
|
||||||
UInt32 depth, d1;
|
UInt32 depth, d1;
|
||||||
Boolean d2;
|
Boolean d2;
|
||||||
WinScreenMode(winScreenModeGet, &d1, &d1, &depth, &d2);
|
WinScreenMode(winScreenModeGet, &d1, &d1, &depth, &d2);
|
||||||
|
|
|
@ -14,7 +14,7 @@ Err GoLCDInit(MemHandle *goLcdH) {
|
||||||
UInt16 refNum;
|
UInt16 refNum;
|
||||||
Boolean loaded = false;
|
Boolean loaded = false;
|
||||||
*goLcdH = NULL;
|
*goLcdH = NULL;
|
||||||
|
|
||||||
if (e = SysLibFind(goLcdLibName, &refNum))
|
if (e = SysLibFind(goLcdLibName, &refNum))
|
||||||
loaded = !(e = SysLibLoad(goLcdLibType, goLcdLibCreator, &refNum));
|
loaded = !(e = SysLibLoad(goLcdLibType, goLcdLibCreator, &refNum));
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Err GoLCDRelease(MemHandle goLcdH) {
|
||||||
|
|
||||||
Err e;
|
Err e;
|
||||||
GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH);
|
GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH);
|
||||||
if (lcdP->refNum != sysInvalidRefNum)
|
if (lcdP->refNum != sysInvalidRefNum)
|
||||||
if (!(e = GoLcdLibClose(lcdP->refNum)))
|
if (!(e = GoLcdLibClose(lcdP->refNum)))
|
||||||
e = SysLibRemove(lcdP->refNum);
|
e = SysLibRemove(lcdP->refNum);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ Boolean GoLCDToggle(MemHandle goLcdH) {
|
||||||
GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH);
|
GoLCDType *lcdP = (GoLCDType *)MemHandleLock(goLcdH);
|
||||||
active = lcdP->active;
|
active = lcdP->active;
|
||||||
MemPtrUnlock(lcdP);
|
MemPtrUnlock(lcdP);
|
||||||
|
|
||||||
GoLCDActivate(goLcdH, !active);
|
GoLCDActivate(goLcdH, !active);
|
||||||
return (!active);
|
return (!active);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ UInt8 PalmScreenSize(Coord *stdw, Coord *stdh, Coord *fullw, Coord *fullh) {
|
||||||
UInt8 mode = 0;
|
UInt8 mode = 0;
|
||||||
|
|
||||||
Coord sw = 160;
|
Coord sw = 160;
|
||||||
Coord sh = 160;
|
Coord sh = 160;
|
||||||
|
|
||||||
// Hi-Density present ?
|
// Hi-Density present ?
|
||||||
if (!FtrGet(sysFtrCreator, sysFtrNumWinVersion, &ftr)) {
|
if (!FtrGet(sysFtrCreator, sysFtrNumWinVersion, &ftr)) {
|
||||||
|
@ -136,7 +136,7 @@ void PalmGetMemory(UInt32* storageMemoryP, UInt32* dynamicMemoryP, UInt32 *stora
|
||||||
UInt32 dynamicFree = 0;
|
UInt32 dynamicFree = 0;
|
||||||
|
|
||||||
// Iterate through each card to support devices with multiple cards.
|
// Iterate through each card to support devices with multiple cards.
|
||||||
nCards = MemNumCards();
|
nCards = MemNumCards();
|
||||||
|
|
||||||
for (cardNo = 0; cardNo < nCards; cardNo++) {
|
for (cardNo = 0; cardNo < nCards; cardNo++) {
|
||||||
// Iterate through the RAM heaps on a card (excludes ROM).
|
// Iterate through the RAM heaps on a card (excludes ROM).
|
||||||
|
|
|
@ -121,7 +121,7 @@ UInt8 SonyScreenSize(UInt16 HRrefNum, Coord *stdw, Coord *stdh, Coord *fullw, Co
|
||||||
UInt8 mode = 0;
|
UInt8 mode = 0;
|
||||||
|
|
||||||
Coord sw = 160;
|
Coord sw = 160;
|
||||||
Coord sh = 160;
|
Coord sh = 160;
|
||||||
Coord fw = sw;
|
Coord fw = sw;
|
||||||
Coord fh = sh;
|
Coord fh = sh;
|
||||||
|
|
||||||
|
@ -158,6 +158,6 @@ UInt8 SonyScreenSize(UInt16 HRrefNum, Coord *stdw, Coord *stdh, Coord *fullw, Co
|
||||||
*stdh = sh;
|
*stdh = sh;
|
||||||
*fullw = fw;
|
*fullw = fw;
|
||||||
*fullh = fh;
|
*fullh = fh;
|
||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ UInt32 StuffsGetPitch(Coord fullw) {
|
||||||
|
|
||||||
if (OPTIONS_TST(kOptModeHiDensity)) {
|
if (OPTIONS_TST(kOptModeHiDensity)) {
|
||||||
WinScreenGetAttribute(winScreenRowBytes, &pitch);
|
WinScreenGetAttribute(winScreenRowBytes, &pitch);
|
||||||
|
|
||||||
// FIXME : hack for TT3 simulator (and real ?) return 28 on landscape mode
|
// FIXME : hack for TT3 simulator (and real ?) return 28 on landscape mode
|
||||||
if (pitch < fullw)
|
if (pitch < fullw)
|
||||||
pitch = fullw;
|
pitch = fullw;
|
||||||
|
|
|
@ -86,7 +86,7 @@ static Err AppStartCheckNotify() {
|
||||||
UInt32 romVersion;
|
UInt32 romVersion;
|
||||||
Err err;
|
Err err;
|
||||||
|
|
||||||
err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion);
|
err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
UInt16 cardNo;
|
UInt16 cardNo;
|
||||||
LocalID dbID;
|
LocalID dbID;
|
||||||
|
@ -128,7 +128,7 @@ static Err AppStartLoadSkin() {
|
||||||
if (type != 'skin' || creator != appFileCreator)
|
if (type != 'skin' || creator != appFileCreator)
|
||||||
err = dmErrInvalidParam;
|
err = dmErrInvalidParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found || err)
|
if (!found || err)
|
||||||
MemSet(&(gPrefs->skin),sizeof(SkinInfoType),0);
|
MemSet(&(gPrefs->skin),sizeof(SkinInfoType),0);
|
||||||
}
|
}
|
||||||
|
@ -141,13 +141,13 @@ static Err AppStartLoadSkin() {
|
||||||
if (!err)
|
if (!err)
|
||||||
err = DmDatabaseInfo (gPrefs->skin.cardNo, gPrefs->skin.dbID, gPrefs->skin.nameP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
err = DmDatabaseInfo (gPrefs->skin.cardNo, gPrefs->skin.dbID, gPrefs->skin.nameP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Err AppStartCheckMathLib() {
|
static Err AppStartCheckMathLib() {
|
||||||
Err e = MathlibInit();
|
Err e = MathlibInit();
|
||||||
|
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case errNone:
|
case errNone:
|
||||||
break;
|
break;
|
||||||
|
@ -158,7 +158,7 @@ static Err AppStartCheckMathLib() {
|
||||||
FrmCustomAlert(FrmErrorAlert,"Can't open MathLib !",0,0);
|
FrmCustomAlert(FrmErrorAlert,"Can't open MathLib !",0,0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ Err AppStart(void) {
|
||||||
gPrefs->exitLauncher = true;
|
gPrefs->exitLauncher = true;
|
||||||
gPrefs->stdPalette = OPTIONS_TST(kOptDeviceOS5);
|
gPrefs->stdPalette = OPTIONS_TST(kOptDeviceOS5);
|
||||||
gPrefs->stylusClick = true;
|
gPrefs->stylusClick = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PrefGetAppPreferences(appFileCreator, appPrefID, gPrefs, &dataSize, true);
|
PrefGetAppPreferences(appFileCreator, appPrefID, gPrefs, &dataSize, true);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ Err AppStart(void) {
|
||||||
|
|
||||||
error = AppStartCheckHRmode();
|
error = AppStartCheckHRmode();
|
||||||
if (error) return (error);
|
if (error) return (error);
|
||||||
|
|
||||||
bDirectMode = (AppStartLoadSkin() != errNone);
|
bDirectMode = (AppStartLoadSkin() != errNone);
|
||||||
|
|
||||||
// if volref previously defined, check if it's a valid one
|
// if volref previously defined, check if it's a valid one
|
||||||
|
@ -318,8 +318,8 @@ static Err AppStopCheckNotify()
|
||||||
{
|
{
|
||||||
UInt32 romVersion;
|
UInt32 romVersion;
|
||||||
Err err;
|
Err err;
|
||||||
|
|
||||||
err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion);
|
err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &romVersion);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
UInt16 cardNo;
|
UInt16 cardNo;
|
||||||
LocalID dbID;
|
LocalID dbID;
|
||||||
|
@ -332,7 +332,7 @@ static Err AppStopCheckNotify()
|
||||||
SysNotifyUnregister(cardNo, dbID, sysNotifyDisplayResizedEvent, sysNotifyNormalPriority);
|
SysNotifyUnregister(cardNo, dbID, sysNotifyDisplayResizedEvent, sysNotifyNormalPriority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ void AppStop(void) {
|
||||||
// Close and move Game list database
|
// Close and move Game list database
|
||||||
GamCloseDatabase(false);
|
GamCloseDatabase(false);
|
||||||
|
|
||||||
// Write the saved preferences / saved-state information. This data
|
// Write the saved preferences / saved-state information. This data
|
||||||
// will saved during a HotSync backup.
|
// will saved during a HotSync backup.
|
||||||
SavePrefs();
|
SavePrefs();
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ static void CardSlotFreeList() {
|
||||||
if (itemsText && itemsList) {
|
if (itemsText && itemsList) {
|
||||||
cards = MemPtrRecoverHandle(itemsList);
|
cards = MemPtrRecoverHandle(itemsList);
|
||||||
items = MemPtrRecoverHandle(itemsText);
|
items = MemPtrRecoverHandle(itemsText);
|
||||||
|
|
||||||
itemsText = NULL;
|
itemsText = NULL;
|
||||||
itemsList = NULL;
|
itemsList = NULL;
|
||||||
}
|
}
|
||||||
|
@ -88,13 +88,13 @@ static UInt16 CardSlotFillList(Boolean getRefNum = false) {
|
||||||
if (err || StrLen(labelP) == 0) { // if no label try to retreive card type
|
if (err || StrLen(labelP) == 0) { // if no label try to retreive card type
|
||||||
VolumeInfoType volInfo;
|
VolumeInfoType volInfo;
|
||||||
err = VFSVolumeInfo(volRefNum, &volInfo);
|
err = VFSVolumeInfo(volRefNum, &volInfo);
|
||||||
|
|
||||||
if (!err) {
|
if (!err) {
|
||||||
ExpCardInfoType info;
|
ExpCardInfoType info;
|
||||||
err = ExpCardInfo(volInfo.slotRefNum, &info);
|
err = ExpCardInfo(volInfo.slotRefNum, &info);
|
||||||
StrCopy(labelP, info.deviceClassStr);
|
StrCopy(labelP, info.deviceClassStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) // if err default name
|
if (err) // if err default name
|
||||||
StrPrintF(labelP,"Other Card %ld", other++);
|
StrPrintF(labelP,"Other Card %ld", other++);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ static UInt16 CardSlotFillList(Boolean getRefNum = false) {
|
||||||
cards = MemHandleNew(sizeof(CardInfoType));
|
cards = MemHandleNew(sizeof(CardInfoType));
|
||||||
else
|
else
|
||||||
MemHandleResize(cards, MemHandleSize(cards) + sizeof(CardInfoType));
|
MemHandleResize(cards, MemHandleSize(cards) + sizeof(CardInfoType));
|
||||||
|
|
||||||
cardsInfo = (CardInfoType *)MemHandleLock(cards);
|
cardsInfo = (CardInfoType *)MemHandleLock(cards);
|
||||||
cardsInfo[counter].volRefNum = volRefNum;
|
cardsInfo[counter].volRefNum = volRefNum;
|
||||||
StrCopy(cardsInfo[counter].nameP, labelP);
|
StrCopy(cardsInfo[counter].nameP, labelP);
|
||||||
|
@ -146,7 +146,7 @@ static UInt16 CardSlotFillList(Boolean getRefNum = false) {
|
||||||
// no card found ? free old list in any or return invalid volref
|
// no card found ? free old list in any or return invalid volref
|
||||||
} else {
|
} else {
|
||||||
if (!getRefNum)
|
if (!getRefNum)
|
||||||
CardSlotFreeList();
|
CardSlotFreeList();
|
||||||
else
|
else
|
||||||
return vfsInvalidVolRef;
|
return vfsInvalidVolRef;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ static UInt16 ConfigTabSave() {
|
||||||
|
|
||||||
CardSlotCreateDirs();
|
CardSlotCreateDirs();
|
||||||
CardSlotFreeList();
|
CardSlotFreeList();
|
||||||
|
|
||||||
return updateCode;
|
return updateCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ Boolean CardSlotFormHandleEvent(EventPtr eventP) {
|
||||||
case CardSlotCancelButton:
|
case CardSlotCancelButton:
|
||||||
CardSlotFormCancel();
|
CardSlotFormCancel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TabCardGameListMoveCheckbox:
|
case TabCardGameListMoveCheckbox:
|
||||||
GameListTabDraw();
|
GameListTabDraw();
|
||||||
break;
|
break;
|
||||||
|
@ -352,7 +352,7 @@ Boolean CardSlotFormHandleEvent(EventPtr eventP) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ static void GameTabInit(GameInfoType *gameInfoP) {
|
||||||
nameP = (Char *)MemHandleLock(nameH);
|
nameP = (Char *)MemHandleLock(nameH);
|
||||||
pathP = (Char *)MemHandleLock(pathH);
|
pathP = (Char *)MemHandleLock(pathH);
|
||||||
gameP = (Char *)MemHandleLock(gameH);
|
gameP = (Char *)MemHandleLock(gameH);
|
||||||
|
|
||||||
if (gameInfoP) {
|
if (gameInfoP) {
|
||||||
LstSetSelection(list1P, gameInfoP->engine);
|
LstSetSelection(list1P, gameInfoP->engine);
|
||||||
LstSetTopItem(list1P, gameInfoP->engine);
|
LstSetTopItem(list1P, gameInfoP->engine);
|
||||||
|
@ -139,7 +139,7 @@ static Err GameTabSave(GameInfoType *gameInfoP) {
|
||||||
MemPtrFree(itemsText);
|
MemPtrFree(itemsText);
|
||||||
itemsText = NULL;
|
itemsText = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return errNone;
|
return errNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ static void DisplayInit(GameInfoType *gameInfoP) {
|
||||||
|
|
||||||
list1P = (ListType *)GetObjectPtr(TabGameDisplayGfxListList);
|
list1P = (ListType *)GetObjectPtr(TabGameDisplayGfxListList);
|
||||||
list2P = (ListType *)GetObjectPtr(TabGameDisplayRenderList);
|
list2P = (ListType *)GetObjectPtr(TabGameDisplayRenderList);
|
||||||
|
|
||||||
if (gameInfoP) {
|
if (gameInfoP) {
|
||||||
LstSetSelection(list1P, gameInfoP->gfxMode);
|
LstSetSelection(list1P, gameInfoP->gfxMode);
|
||||||
LstSetSelection(list2P, gameInfoP->renderMode);
|
LstSetSelection(list2P, gameInfoP->renderMode);
|
||||||
|
@ -169,7 +169,7 @@ static void DisplayInit(GameInfoType *gameInfoP) {
|
||||||
|
|
||||||
static Err DisplaySave(GameInfoType *gameInfoP) {
|
static Err DisplaySave(GameInfoType *gameInfoP) {
|
||||||
ListType *list1P, *list2P;
|
ListType *list1P, *list2P;
|
||||||
ControlType *cck6P, *cck7P, *cck8P;
|
ControlType *cck6P, *cck7P, *cck8P;
|
||||||
|
|
||||||
FormType *frmP = FrmGetActiveForm();
|
FormType *frmP = FrmGetActiveForm();
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ static Err DisplaySave(GameInfoType *gameInfoP) {
|
||||||
gameInfoP->fullscreen = CtlGetValue(cck7P);
|
gameInfoP->fullscreen = CtlGetValue(cck7P);
|
||||||
gameInfoP->aspectRatio = CtlGetValue(cck8P);
|
gameInfoP->aspectRatio = CtlGetValue(cck8P);
|
||||||
}
|
}
|
||||||
|
|
||||||
return errNone;
|
return errNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ static void OptionsInit(GameInfoType *gameInfoP) {
|
||||||
|
|
||||||
static Err OptionsSave(GameInfoType *gameInfoP) {
|
static Err OptionsSave(GameInfoType *gameInfoP) {
|
||||||
FieldType *fld4P, *fld5P, *fld6P;
|
FieldType *fld4P, *fld5P, *fld6P;
|
||||||
ControlType *cck1P, *cck2P, *cck3P, *cck4P, *cck5P;
|
ControlType *cck1P, *cck2P, *cck3P, *cck4P, *cck5P;
|
||||||
ListType *list2P, *list3P;
|
ListType *list2P, *list3P;
|
||||||
|
|
||||||
FormType *frmP = FrmGetActiveForm();
|
FormType *frmP = FrmGetActiveForm();
|
||||||
|
@ -291,7 +291,7 @@ static Err OptionsSave(GameInfoType *gameInfoP) {
|
||||||
} else {
|
} else {
|
||||||
gameInfoP->language = LstGetSelection(list2P);
|
gameInfoP->language = LstGetSelection(list2P);
|
||||||
gameInfoP->platform = LstGetSelection(list3P);
|
gameInfoP->platform = LstGetSelection(list3P);
|
||||||
|
|
||||||
gameInfoP->autoLoad = CtlGetValue(cck1P);
|
gameInfoP->autoLoad = CtlGetValue(cck1P);
|
||||||
gameInfoP->bootParam = CtlGetValue(cck2P);
|
gameInfoP->bootParam = CtlGetValue(cck2P);
|
||||||
gameInfoP->setPlatform = CtlGetValue(cck3P);
|
gameInfoP->setPlatform = CtlGetValue(cck3P);
|
||||||
|
@ -302,7 +302,7 @@ static Err OptionsSave(GameInfoType *gameInfoP) {
|
||||||
gameInfoP->bootValue = StrAToI(FldGetTextPtr(fld5P));
|
gameInfoP->bootValue = StrAToI(FldGetTextPtr(fld5P));
|
||||||
gameInfoP->talkValue = StrAToI(FldGetTextPtr(fld6P));
|
gameInfoP->talkValue = StrAToI(FldGetTextPtr(fld6P));
|
||||||
}
|
}
|
||||||
|
|
||||||
return errNone;
|
return errNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ static void GameManSave(UInt16 index) {
|
||||||
newGameInfo.version = curItemVersion;
|
newGameInfo.version = curItemVersion;
|
||||||
newGameInfo.icnID = 0xFFFF;
|
newGameInfo.icnID = 0xFFFF;
|
||||||
newGameInfo.selected = true;
|
newGameInfo.selected = true;
|
||||||
|
|
||||||
// default sound data
|
// default sound data
|
||||||
newGameInfo.musicInfo.volume.palm = 50;
|
newGameInfo.musicInfo.volume.palm = 50;
|
||||||
newGameInfo.musicInfo.volume.music = 192;
|
newGameInfo.musicInfo.volume.music = 192;
|
||||||
|
@ -383,7 +383,7 @@ static void GameManSave(UInt16 index) {
|
||||||
newGameInfo.musicInfo.sound.defaultTrackLength = 10;
|
newGameInfo.musicInfo.sound.defaultTrackLength = 10;
|
||||||
newGameInfo.musicInfo.sound.firstTrack = 1;
|
newGameInfo.musicInfo.sound.firstTrack = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameTabSave(&newGameInfo);
|
GameTabSave(&newGameInfo);
|
||||||
DisplaySave(&newGameInfo);
|
DisplaySave(&newGameInfo);
|
||||||
OptionsSave(&newGameInfo);
|
OptionsSave(&newGameInfo);
|
||||||
|
@ -397,14 +397,14 @@ static void GameManSave(UInt16 index) {
|
||||||
{
|
{
|
||||||
RectangleType rArea;
|
RectangleType rArea;
|
||||||
UInt16 posIndex, maxView;
|
UInt16 posIndex, maxView;
|
||||||
|
|
||||||
// get the sorted index
|
// get the sorted index
|
||||||
index = GamGetSelected();
|
index = GamGetSelected();
|
||||||
// if new item is out of the list bounds, change current list pos
|
// if new item is out of the list bounds, change current list pos
|
||||||
SknGetListBounds(&rArea, NULL);
|
SknGetListBounds(&rArea, NULL);
|
||||||
maxView = rArea.extent.y / sknInfoListItemSize;
|
maxView = rArea.extent.y / sknInfoListItemSize;
|
||||||
posIndex = gPrefs->listPosition;
|
posIndex = gPrefs->listPosition;
|
||||||
|
|
||||||
// if out of the current list position
|
// if out of the current list position
|
||||||
if (!(index >= posIndex && index < (posIndex + maxView)))
|
if (!(index >= posIndex && index < (posIndex + maxView)))
|
||||||
gPrefs->listPosition = index; // this value is corrected in SknUpdateList if needed
|
gPrefs->listPosition = index; // this value is corrected in SknUpdateList if needed
|
||||||
|
@ -421,7 +421,7 @@ static void GameManSave(UInt16 index) {
|
||||||
* FUNCTION: EditGameFormInit
|
* FUNCTION: EditGameFormInit
|
||||||
* FUNCTION: EditGameFormHandleEvent
|
* FUNCTION: EditGameFormHandleEvent
|
||||||
*
|
*
|
||||||
* DESCRIPTION:
|
* DESCRIPTION:
|
||||||
*
|
*
|
||||||
* REVISION HISTORY:
|
* REVISION HISTORY:
|
||||||
*
|
*
|
||||||
|
@ -468,14 +468,14 @@ static void EditGameBowser() {
|
||||||
UInt16 volRefNum = gPrefs->card.volRefNum;
|
UInt16 volRefNum = gPrefs->card.volRefNum;
|
||||||
Char *textP, *pathP = (Char *)MemPtrNew(kFileBrowserLibPathBufferSize);
|
Char *textP, *pathP = (Char *)MemPtrNew(kFileBrowserLibPathBufferSize);
|
||||||
pathP[0] = chrNull;
|
pathP[0] = chrNull;
|
||||||
|
|
||||||
if (FileBrowserLibShowOpenDialog(refNum, &volRefNum, pathP, 0, 0, 0, "Game Data Path", kFileBrowserLibFlagNoFiles)) {
|
if (FileBrowserLibShowOpenDialog(refNum, &volRefNum, pathP, 0, 0, 0, "Game Data Path", kFileBrowserLibFlagNoFiles)) {
|
||||||
FieldPtr fldP;
|
FieldPtr fldP;
|
||||||
MemHandle textH;
|
MemHandle textH;
|
||||||
Int16 offset, copySize, maxSize;
|
Int16 offset, copySize, maxSize;
|
||||||
|
|
||||||
fldP = (FieldType *)GetObjectPtr(TabGameInfoPathField);
|
fldP = (FieldType *)GetObjectPtr(TabGameInfoPathField);
|
||||||
maxSize = FldGetMaxChars(fldP);
|
maxSize = FldGetMaxChars(fldP);
|
||||||
textH = FldGetTextHandle(fldP);
|
textH = FldGetTextHandle(fldP);
|
||||||
|
|
||||||
FldSetTextHandle(fldP, NULL);
|
FldSetTextHandle(fldP, NULL);
|
||||||
|
@ -518,7 +518,7 @@ Boolean EditGameFormHandleEvent(EventPtr eventP) {
|
||||||
EditGameCancel();
|
EditGameCancel();
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case frmOpenEvent:
|
case frmOpenEvent:
|
||||||
switch (gFormEditMode) {
|
switch (gFormEditMode) {
|
||||||
case edtModeAdd:
|
case edtModeAdd:
|
||||||
|
@ -567,11 +567,11 @@ Boolean EditGameFormHandleEvent(EventPtr eventP) {
|
||||||
case GameEditCancelButton:
|
case GameEditCancelButton:
|
||||||
EditGameCancel();
|
EditGameCancel();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GameEditDeleteButton:
|
case GameEditDeleteButton:
|
||||||
EditGameFormDelete(false);
|
EditGameFormDelete(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TabGameInfoBrowsePushButton:
|
case TabGameInfoBrowsePushButton:
|
||||||
EditGameBowser();
|
EditGameBowser();
|
||||||
break;
|
break;
|
||||||
|
@ -607,6 +607,6 @@ Boolean EditGameFormHandleEvent(EventPtr eventP) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ static Boolean ScummVMTabSave() {
|
||||||
|
|
||||||
fld1P = (FieldType *)GetObjectPtr(TabMiscScummVMDebugLevelField);
|
fld1P = (FieldType *)GetObjectPtr(TabMiscScummVMDebugLevelField);
|
||||||
fld2P = (FieldType *)GetObjectPtr(TabMiscScummVMAutosaveField);
|
fld2P = (FieldType *)GetObjectPtr(TabMiscScummVMAutosaveField);
|
||||||
|
|
||||||
cckP[0] = (ControlType *)GetObjectPtr(TabMiscScummVMAutosaveCheckbox);
|
cckP[0] = (ControlType *)GetObjectPtr(TabMiscScummVMAutosaveCheckbox);
|
||||||
cckP[3] = (ControlType *)GetObjectPtr(TabMiscScummVMDebugCheckbox);
|
cckP[3] = (ControlType *)GetObjectPtr(TabMiscScummVMDebugCheckbox);
|
||||||
cckP[6] = (ControlType *)GetObjectPtr(TabMiscScummVMDemoCheckbox);
|
cckP[6] = (ControlType *)GetObjectPtr(TabMiscScummVMDemoCheckbox);
|
||||||
|
@ -69,7 +69,7 @@ static Boolean ScummVMTabSave() {
|
||||||
|
|
||||||
gPrefs->debugLevel = StrAToI(FldGetTextPtr(fld1P));
|
gPrefs->debugLevel = StrAToI(FldGetTextPtr(fld1P));
|
||||||
gPrefs->autoSavePeriod = StrAToI(FldGetTextPtr(fld2P));
|
gPrefs->autoSavePeriod = StrAToI(FldGetTextPtr(fld2P));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ static void ExtsTabSave() {
|
||||||
gPrefs->lightspeed.enable = CtlGetValue(cckP[0]);
|
gPrefs->lightspeed.enable = CtlGetValue(cckP[0]);
|
||||||
gPrefs->lightspeed.mode = LstGetSelection(list1P);
|
gPrefs->lightspeed.mode = LstGetSelection(list1P);
|
||||||
}
|
}
|
||||||
if (OPTIONS_TST(kOptGoLcdAPI)) {
|
if (OPTIONS_TST(kOptGoLcdAPI)) {
|
||||||
cckP[1] = (ControlType *)GetObjectPtr(TabMiscExtsGolcdCheckbox);
|
cckP[1] = (ControlType *)GetObjectPtr(TabMiscExtsGolcdCheckbox);
|
||||||
gPrefs->goLCD = CtlGetValue(cckP[1]);
|
gPrefs->goLCD = CtlGetValue(cckP[1]);
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ static void MiscFormSave() {
|
||||||
if (!ScummVMTabSave()) return;
|
if (!ScummVMTabSave()) return;
|
||||||
PalmOSTabSave();
|
PalmOSTabSave();
|
||||||
ExtsTabSave();
|
ExtsTabSave();
|
||||||
|
|
||||||
TabDeleteTabs(myTabP);
|
TabDeleteTabs(myTabP);
|
||||||
FrmReturnToMain();
|
FrmReturnToMain();
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ static void MiscFormInit() {
|
||||||
TabMoveUpObject(frmP, TabMiscExtsNothingLabel, 12);
|
TabMoveUpObject(frmP, TabMiscExtsNothingLabel, 12);
|
||||||
extsCnt--;
|
extsCnt--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extsCnt)
|
if (extsCnt)
|
||||||
FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsNothingLabel));
|
FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsNothingLabel));
|
||||||
|
|
||||||
|
@ -270,6 +270,6 @@ Boolean MiscFormHandleEvent(EventPtr eventP) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,10 +197,10 @@ static void SelectorFormInit() {
|
||||||
|
|
||||||
listP = (ListType *)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, EngineListList));
|
listP = (ListType *)FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, EngineListList));
|
||||||
itemsText = (Char **)MemPtrNew(ENGINE_COUNT * sizeof(Char *));
|
itemsText = (Char **)MemPtrNew(ENGINE_COUNT * sizeof(Char *));
|
||||||
|
|
||||||
for (int i = 0; i < ENGINE_COUNT; i++)
|
for (int i = 0; i < ENGINE_COUNT; i++)
|
||||||
itemsText[i] = (Char *)engines[i].nameP;
|
itemsText[i] = (Char *)engines[i].nameP;
|
||||||
|
|
||||||
LstSetListChoices (listP, itemsText, ENGINE_COUNT);
|
LstSetListChoices (listP, itemsText, ENGINE_COUNT);
|
||||||
LstSetSelection(listP, 0);
|
LstSetSelection(listP, 0);
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ Boolean SelectorFormHandleEvent(EventPtr eventP) {
|
||||||
case lstSelectEvent:
|
case lstSelectEvent:
|
||||||
if (eventP->data.lstSelect.listID == EngineSupportedList)
|
if (eventP->data.lstSelect.listID == EngineSupportedList)
|
||||||
LstSetSelection(eventP->data.lstSelect.pList, -1);
|
LstSetSelection(eventP->data.lstSelect.pList, -1);
|
||||||
else
|
else
|
||||||
SelectorSetList(eventP->data.lstSelect.selection);
|
SelectorSetList(eventP->data.lstSelect.selection);
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
@ -273,6 +273,6 @@ Boolean SelectorFormHandleEvent(EventPtr eventP) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@ static void SystemTabDraw() {
|
||||||
PalmGetMemory(&sm, &dm, &sf, 0);
|
PalmGetMemory(&sm, &dm, &sf, 0);
|
||||||
stack = GetStackSize();
|
stack = GetStackSize();
|
||||||
df = gVars->startupMemory;
|
df = gVars->startupMemory;
|
||||||
|
|
||||||
WinSetTextColor(UIColorGetTableEntryIndex(UIObjectForeground));
|
WinSetTextColor(UIColorGetTableEntryIndex(UIObjectForeground));
|
||||||
FntSetFont(stdFont);
|
FntSetFont(stdFont);
|
||||||
|
|
||||||
StrIToA(num, dm);
|
StrIToA(num, dm);
|
||||||
x = 147 - FntCharsWidth(num, StrLen(num)) + 5;
|
x = 147 - FntCharsWidth(num, StrLen(num)) + 5;
|
||||||
WinDrawChars(num, StrLen(num), x, 12 + 30);
|
WinDrawChars(num, StrLen(num), x, 12 + 30);
|
||||||
|
@ -115,7 +115,7 @@ Boolean InfoFormHandleEvent(EventPtr eventP) {
|
||||||
InfoFormInit();
|
InfoFormInit();
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case frmCloseEvent:
|
case frmCloseEvent:
|
||||||
InfoFormSave();
|
InfoFormSave();
|
||||||
handled = true;
|
handled = true;
|
||||||
|
@ -141,6 +141,6 @@ Boolean InfoFormHandleEvent(EventPtr eventP) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ static Err BeamMe() {
|
||||||
err = SendDatabase(0, dbID, "ScummVM.prc", "\nPlay your favorite LucasArts games");
|
err = SendDatabase(0, dbID, "ScummVM.prc", "\nPlay your favorite LucasArts games");
|
||||||
else
|
else
|
||||||
err = DmGetLastErr();
|
err = DmGetLastErr();
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ static Boolean MainFormDoCommand(UInt16 command)
|
||||||
FrmPopupForm(GameEditForm);
|
FrmPopupForm(GameEditForm);
|
||||||
handled = true;
|
handled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MainGamesDelete:
|
case MainGamesDelete:
|
||||||
EditGameFormDelete(true);
|
EditGameFormDelete(true);
|
||||||
handled = true;
|
handled = true;
|
||||||
|
|
|
@ -256,7 +256,7 @@ static void MusicFormInit(UInt16 index) {
|
||||||
|
|
||||||
recordH = DmQueryRecord(gameDB, index);
|
recordH = DmQueryRecord(gameDB, index);
|
||||||
ogameInfoP = (GameInfoType *)MemHandleLock(recordH);
|
ogameInfoP = (GameInfoType *)MemHandleLock(recordH);
|
||||||
|
|
||||||
if (!ogameInfoP) {
|
if (!ogameInfoP) {
|
||||||
FrmCustomAlert(FrmErrorAlert, "An error occured.",0,0);
|
FrmCustomAlert(FrmErrorAlert, "An error occured.",0,0);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -26,7 +26,7 @@ void TabDeleteTabs(TabType *tabP) {
|
||||||
UInt16 cnt, num;
|
UInt16 cnt, num;
|
||||||
num = MemPtrSize(tabP->tabs) / sizeof(TabDataType);
|
num = MemPtrSize(tabP->tabs) / sizeof(TabDataType);
|
||||||
|
|
||||||
for (cnt = 0; cnt < num; cnt++)
|
for (cnt = 0; cnt < num; cnt++)
|
||||||
FrmDeleteForm(tabP->tabs[cnt].srcP);
|
FrmDeleteForm(tabP->tabs[cnt].srcP);
|
||||||
|
|
||||||
delete tabP->tabs;
|
delete tabP->tabs;
|
||||||
|
@ -93,7 +93,7 @@ Err TabAddContent(FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscI
|
||||||
UInt16 items = LstGetNumberOfItems((ListType *)objP);
|
UInt16 items = LstGetNumberOfItems((ListType *)objP);
|
||||||
UInt16 trigger = id - 1;
|
UInt16 trigger = id - 1;
|
||||||
trigger = (FrmGetObjectIndex((FormType *)*dstP, trigger) != frmInvalidObjectId) ? trigger : 0;
|
trigger = (FrmGetObjectIndex((FormType *)*dstP, trigger) != frmInvalidObjectId) ? trigger : 0;
|
||||||
|
|
||||||
LstNewList(dstP, id, x, y, w, h, font, visible, trigger);
|
LstNewList(dstP, id, x, y, w, h, font, visible, trigger);
|
||||||
newP = (ListType *)FrmGetObjectPtr((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id));
|
newP = (ListType *)FrmGetObjectPtr((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id));
|
||||||
LstSetListChoices(newP, itemsP, items);
|
LstSetListChoices(newP, itemsP, items);
|
||||||
|
@ -197,10 +197,10 @@ void TabSetActive(FormType *frmP, TabType *tabP, UInt16 num) {
|
||||||
|
|
||||||
r.topLeft.y -= 1;
|
r.topLeft.y -= 1;
|
||||||
WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame));
|
WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame));
|
||||||
WinDrawRectangleFrame(simpleFrame, &r);
|
WinDrawRectangleFrame(simpleFrame, &r);
|
||||||
WinSetForeColor(line);
|
WinSetForeColor(line);
|
||||||
WinDrawLine(r.topLeft.x, r.topLeft.y, r.topLeft.x + r.extent.x - 1, r.topLeft.y);
|
WinDrawLine(r.topLeft.x, r.topLeft.y, r.topLeft.x + r.extent.x - 1, r.topLeft.y);
|
||||||
FrmShowObject(frmP, idx);
|
FrmShowObject(frmP, idx);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
UInt8 frame = UIColorGetTableEntryIndex(UIObjectFrame);
|
UInt8 frame = UIColorGetTableEntryIndex(UIObjectFrame);
|
||||||
|
@ -211,7 +211,7 @@ void TabSetActive(FormType *frmP, TabType *tabP, UInt16 num) {
|
||||||
light.b = (255 - light.b) > 72 ? light.b + 72 : 255;
|
light.b = (255 - light.b) > 72 ? light.b + 72 : 255;
|
||||||
|
|
||||||
WinSetForeColor(WinRGBToIndex(&light));
|
WinSetForeColor(WinRGBToIndex(&light));
|
||||||
WinDrawRectangleFrame(simpleFrame, &r);
|
WinDrawRectangleFrame(simpleFrame, &r);
|
||||||
WinSetForeColor(frame);
|
WinSetForeColor(frame);
|
||||||
WinDrawLine(r.topLeft.x - 1, r.topLeft.y + r.extent.y, r.topLeft.x + r.extent.x, r.topLeft.y + r.extent.y);
|
WinDrawLine(r.topLeft.x - 1, r.topLeft.y + r.extent.y, r.topLeft.x + r.extent.x, r.topLeft.y + r.extent.y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ static Err GamUpdateList() {
|
||||||
|
|
||||||
// new format
|
// new format
|
||||||
gitCur.version = curItemVersion;
|
gitCur.version = curItemVersion;
|
||||||
|
|
||||||
if (version < itemVersion_300) {
|
if (version < itemVersion_300) {
|
||||||
gitCur.musicInfo.volume.palm = 50;
|
gitCur.musicInfo.volume.palm = 50;
|
||||||
gitCur.musicInfo.volume.music = 192;
|
gitCur.musicInfo.volume.music = 192;
|
||||||
|
@ -109,7 +109,7 @@ static Err GamUpdateList() {
|
||||||
|
|
||||||
if (version < itemVersion_310)
|
if (version < itemVersion_310)
|
||||||
gitCur.engine = 0;
|
gitCur.engine = 0;
|
||||||
|
|
||||||
if (version < itemVersion_320)
|
if (version < itemVersion_320)
|
||||||
gitCur.renderMode = 0;
|
gitCur.renderMode = 0;
|
||||||
|
|
||||||
|
@ -159,34 +159,34 @@ static Err GamUpdateList() {
|
||||||
|
|
||||||
if (version <= itemVersion_340) {
|
if (version <= itemVersion_340) {
|
||||||
gitCur.platform++;
|
gitCur.platform++;
|
||||||
|
|
||||||
if (gitCur.language == 3)
|
if (gitCur.language == 3)
|
||||||
gitCur.language = 0;
|
gitCur.language = 0;
|
||||||
else if (gitCur.language >= 11)
|
else if (gitCur.language >= 11)
|
||||||
gitCur.language++;
|
gitCur.language++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version <= itemVersion_350)
|
if (version <= itemVersion_350)
|
||||||
if (gitCur.platform >= 9)
|
if (gitCur.platform >= 9)
|
||||||
gitCur.platform++;
|
gitCur.platform++;
|
||||||
|
|
||||||
if (version <= itemVersion_351) {
|
if (version <= itemVersion_351) {
|
||||||
if (gitCur.engine >= ENGINE_LURE) // newly added engine
|
if (gitCur.engine >= ENGINE_LURE) // newly added engine
|
||||||
gitCur.engine++;
|
gitCur.engine++;
|
||||||
|
|
||||||
if (gitCur.engine == ENGINE_SCUMM) // reorder
|
if (gitCur.engine == ENGINE_SCUMM) // reorder
|
||||||
gitCur.engine = ENGINE_AGOS;
|
gitCur.engine = ENGINE_AGOS;
|
||||||
else if (gitCur.engine == ENGINE_AGOS)
|
else if (gitCur.engine == ENGINE_AGOS)
|
||||||
gitCur.engine = ENGINE_SCUMM;
|
gitCur.engine = ENGINE_SCUMM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version <= itemVersion_352) {
|
if (version <= itemVersion_352) {
|
||||||
if (gitCur.engine >= ENGINE_CINE) // newly added engine
|
if (gitCur.engine >= ENGINE_CINE) // newly added engine
|
||||||
gitCur.engine++;
|
gitCur.engine++;
|
||||||
|
|
||||||
gitCur.platform++;
|
gitCur.platform++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version <= itemVersion_353)
|
if (version <= itemVersion_353)
|
||||||
gitCur.musicInfo.sound.drvMusic++;
|
gitCur.musicInfo.sound.drvMusic++;
|
||||||
|
|
||||||
|
@ -288,16 +288,16 @@ static Err GamUpdateList() {
|
||||||
|
|
||||||
// to V3.5
|
// to V3.5
|
||||||
gitCur.platform++;
|
gitCur.platform++;
|
||||||
|
|
||||||
if (gitCur.language == 3)
|
if (gitCur.language == 3)
|
||||||
gitCur.language = 0;
|
gitCur.language = 0;
|
||||||
else if (gitCur.language >= 11)
|
else if (gitCur.language >= 11)
|
||||||
gitCur.language++;
|
gitCur.language++;
|
||||||
|
|
||||||
// to V3.5.1
|
// to V3.5.1
|
||||||
if (gitCur.platform >= 9)
|
if (gitCur.platform >= 9)
|
||||||
gitCur.platform++;
|
gitCur.platform++;
|
||||||
|
|
||||||
//to V3.5.3
|
//to V3.5.3
|
||||||
gitCur.musicInfo.sound.drvMusic++;
|
gitCur.musicInfo.sound.drvMusic++;
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ static Err GamUpdateList() {
|
||||||
FrmDeleteForm(frmP);
|
FrmDeleteForm(frmP);
|
||||||
if (ofmP)
|
if (ofmP)
|
||||||
FrmSetActiveForm(ofmP);
|
FrmSetActiveForm(ofmP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ Boolean GamJumpTo(Char letter) {
|
||||||
|
|
||||||
GamUnselect();
|
GamUnselect();
|
||||||
DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean));
|
DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean));
|
||||||
|
|
||||||
if (index < gPrefs->listPosition || index >= (gPrefs->listPosition + maxView))
|
if (index < gPrefs->listPosition || index >= (gPrefs->listPosition + maxView))
|
||||||
gPrefs->listPosition = index;
|
gPrefs->listPosition = index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ UInt16 ModFind(const Char *f) {
|
||||||
if (!e) e = VFSFileClose(r);
|
if (!e) e = VFSFileClose(r);
|
||||||
if (!e) break;
|
if (!e) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return volRefNum;
|
return volRefNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ static void ModSetStack(UInt32 newSize, UInt16 cardNo, LocalID dbID) {
|
||||||
if (dbRef) {
|
if (dbRef) {
|
||||||
MemHandle pref = DmGetResource('pref',0);
|
MemHandle pref = DmGetResource('pref',0);
|
||||||
UInt32 size = 0;
|
UInt32 size = 0;
|
||||||
|
|
||||||
if (pref) {
|
if (pref) {
|
||||||
SysAppPrefsType *data = (SysAppPrefsType *)MemHandleLock(pref);
|
SysAppPrefsType *data = (SysAppPrefsType *)MemHandleLock(pref);
|
||||||
size = data->stackSize;
|
size = data->stackSize;
|
||||||
|
@ -273,7 +273,7 @@ Boolean StartScummVM(Int16 engine) {
|
||||||
case 5:
|
case 5:
|
||||||
ArgsAdd(&argvP[argc], "--render-mode=", "hercGreen", &argc);
|
ArgsAdd(&argvP[argc], "--render-mode=", "hercGreen", &argc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (gameInfoP->gfxMode) {
|
switch (gameInfoP->gfxMode) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -311,7 +311,7 @@ Boolean StartScummVM(Int16 engine) {
|
||||||
"segacd",
|
"segacd",
|
||||||
"windows"
|
"windows"
|
||||||
};
|
};
|
||||||
ArgsAdd(&argvP[argc], "--platform=", platform[gameInfoP->platform], &argc);
|
ArgsAdd(&argvP[argc], "--platform=", platform[gameInfoP->platform], &argc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// subtitles
|
// subtitles
|
||||||
|
@ -354,7 +354,7 @@ Boolean StartScummVM(Int16 engine) {
|
||||||
else
|
else
|
||||||
ArgsAdd(&argvP[argc], "-e", "auto", &argc); // no driver, switch to auto
|
ArgsAdd(&argvP[argc], "-e", "auto", &argc); // no driver, switch to auto
|
||||||
} else {
|
} else {
|
||||||
ArgsAdd(&argvP[argc], "-e", drv[gameInfoP->musicInfo.sound.drvMusic], &argc);
|
ArgsAdd(&argvP[argc], "-e", drv[gameInfoP->musicInfo.sound.drvMusic], &argc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// output rate
|
// output rate
|
||||||
|
@ -398,7 +398,7 @@ Boolean StartScummVM(Int16 engine) {
|
||||||
if (gPrefs->altIntro)
|
if (gPrefs->altIntro)
|
||||||
ArgsAdd(&argvP[argc], "--alt-intro", NULL, &argc);
|
ArgsAdd(&argvP[argc], "--alt-intro", NULL, &argc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine == ENGINE_SCUMM) {
|
if (engine == ENGINE_SCUMM) {
|
||||||
// demo mode ?
|
// demo mode ?
|
||||||
if (gPrefs->demoMode)
|
if (gPrefs->demoMode)
|
||||||
|
@ -418,7 +418,7 @@ Boolean StartScummVM(Int16 engine) {
|
||||||
lightspeed= (gPrefs->lightspeed.enable ? gPrefs->lightspeed.mode : 255);
|
lightspeed= (gPrefs->lightspeed.enable ? gPrefs->lightspeed.mode : 255);
|
||||||
toLauncher= (gPrefs->exitLauncher);
|
toLauncher= (gPrefs->exitLauncher);
|
||||||
|
|
||||||
// gVars values
|
// gVars values
|
||||||
// (gVars->HRrefNum defined in checkHRmode on Clie)
|
// (gVars->HRrefNum defined in checkHRmode on Clie)
|
||||||
#ifndef _DEBUG_ENGINE
|
#ifndef _DEBUG_ENGINE
|
||||||
gVars->VFS.volRefNum = (gPrefs->card.autoDetect ? vfsInvalidVolRef : gPrefs->card.volRefNum);
|
gVars->VFS.volRefNum = (gPrefs->card.autoDetect ? vfsInvalidVolRef : gPrefs->card.volRefNum);
|
||||||
|
@ -436,12 +436,12 @@ Boolean StartScummVM(Int16 engine) {
|
||||||
|
|
||||||
// user params
|
// user params
|
||||||
HWR_RSTALL();
|
HWR_RSTALL();
|
||||||
|
|
||||||
if (gPrefs->goLCD)
|
if (gPrefs->goLCD)
|
||||||
HWR_SET(INIT_GOLCD);
|
HWR_SET(INIT_GOLCD);
|
||||||
else
|
else
|
||||||
OPTIONS_RST(kOptGoLcdAPI);
|
OPTIONS_RST(kOptGoLcdAPI);
|
||||||
|
|
||||||
if (!gPrefs->autoOff)
|
if (!gPrefs->autoOff)
|
||||||
HWR_SET(INIT_AUTOOFF);
|
HWR_SET(INIT_AUTOOFF);
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ void SknGetObjectBounds(DmOpenRef skinDBP, DmResID resID, RectangleType *rP) {
|
||||||
rP->topLeft.x = strTemp[sknInfoPosX] * 2;
|
rP->topLeft.x = strTemp[sknInfoPosX] * 2;
|
||||||
rP->topLeft.y = strTemp[sknInfoPosY] * 2;
|
rP->topLeft.y = strTemp[sknInfoPosY] * 2;
|
||||||
|
|
||||||
MemPtrUnlock(strTemp);
|
MemPtrUnlock(strTemp);
|
||||||
DmReleaseResource(hStr);
|
DmReleaseResource(hStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,8 +274,8 @@ UInt8 SknSetState(DmOpenRef skinDBP, DmResID resID, UInt8 newState) {
|
||||||
DmWrite(strTemp, 0, &newState, 1);
|
DmWrite(strTemp, 0, &newState, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemPtrUnlock(strTemp);
|
MemPtrUnlock(strTemp);
|
||||||
DmReleaseResource(hStr);
|
DmReleaseResource(hStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,8 +298,8 @@ UInt8 SknGetDepth(DmOpenRef skinDBP) {
|
||||||
if (hStr) {
|
if (hStr) {
|
||||||
strTemp = (UInt8 *)MemHandleLock(hStr);
|
strTemp = (UInt8 *)MemHandleLock(hStr);
|
||||||
depth = *strTemp;
|
depth = *strTemp;
|
||||||
MemPtrUnlock(strTemp);
|
MemPtrUnlock(strTemp);
|
||||||
DmReleaseResource(hStr);
|
DmReleaseResource(hStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,9 +321,9 @@ UInt8 SknGetState(DmOpenRef skinDBP, DmResID resID) {
|
||||||
|
|
||||||
if (hStr) {
|
if (hStr) {
|
||||||
strTemp = (UInt8 *)MemHandleLock(hStr);
|
strTemp = (UInt8 *)MemHandleLock(hStr);
|
||||||
oldState = strTemp[sknInfoState];
|
oldState = strTemp[sknInfoState];
|
||||||
MemPtrUnlock(strTemp);
|
MemPtrUnlock(strTemp);
|
||||||
DmReleaseResource(hStr);
|
DmReleaseResource(hStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ void SknUpdateList() {
|
||||||
x = rCopy.topLeft.x;
|
x = rCopy.topLeft.x;
|
||||||
y = rCopy.topLeft.y;
|
y = rCopy.topLeft.y;
|
||||||
rCopy.topLeft.x -= rField.topLeft.x;
|
rCopy.topLeft.x -= rField.topLeft.x;
|
||||||
rCopy.topLeft.y -= rField.topLeft.y;
|
rCopy.topLeft.y -= rField.topLeft.y;
|
||||||
SknCopyBits(skinDBP, skinBackgroundImageTop, &rCopy, x, y);
|
SknCopyBits(skinDBP, skinBackgroundImageTop, &rCopy, x, y);
|
||||||
// copy bottom bg
|
// copy bottom bg
|
||||||
SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &rField);
|
SknGetObjectBounds(skinDBP, skinBackgroundImageBottom, &rField);
|
||||||
|
@ -458,7 +458,7 @@ void SknUpdateList() {
|
||||||
x = rCopy.topLeft.x;
|
x = rCopy.topLeft.x;
|
||||||
y = rCopy.topLeft.y;
|
y = rCopy.topLeft.y;
|
||||||
rCopy.topLeft.x -= rField.topLeft.x;
|
rCopy.topLeft.x -= rField.topLeft.x;
|
||||||
rCopy.topLeft.y -= rField.topLeft.y;
|
rCopy.topLeft.y -= rField.topLeft.y;
|
||||||
SknCopyBits(skinDBP, skinBackgroundImageBottom, &rCopy, x, y);
|
SknCopyBits(skinDBP, skinBackgroundImageBottom, &rCopy, x, y);
|
||||||
|
|
||||||
FntSetFont(stdFont);
|
FntSetFont(stdFont);
|
||||||
|
|
|
@ -97,9 +97,9 @@ Err SendDatabase (UInt16 cardNo, LocalID dbID, Char *nameP, Char *descriptionP)
|
||||||
* minimum requirement.
|
* minimum requirement.
|
||||||
*
|
*
|
||||||
* PARAMETERS: requiredVersion - minimum rom version required
|
* PARAMETERS: requiredVersion - minimum rom version required
|
||||||
* (see sysFtrNumROMVersion in SystemMgr.h
|
* (see sysFtrNumROMVersion in SystemMgr.h
|
||||||
* for format)
|
* for format)
|
||||||
* launchFlags - flags that indicate if the application
|
* launchFlags - flags that indicate if the application
|
||||||
* UI is initialized.
|
* UI is initialized.
|
||||||
*
|
*
|
||||||
* RETURNED: error code or zero if rom is compatible
|
* RETURNED: error code or zero if rom is compatible
|
||||||
|
@ -119,7 +119,7 @@ static Err RomVersionCompatible(UInt32 requiredVersion, UInt16 launchFlags) {
|
||||||
|
|
||||||
FrmAlert (RomIncompatibleAlert);
|
FrmAlert (RomIncompatibleAlert);
|
||||||
|
|
||||||
// Palm OS 1.0 will continuously relaunch this app unless we switch to
|
// Palm OS 1.0 will continuously relaunch this app unless we switch to
|
||||||
// another safe one.
|
// another safe one.
|
||||||
if (romVersion <= kPalmOS10Version)
|
if (romVersion <= kPalmOS10Version)
|
||||||
AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
|
AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
|
||||||
|
@ -210,7 +210,7 @@ static Boolean AppHandleEvent(EventPtr eventP) {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ static Boolean AppHandleEvent(EventPtr eventP) {
|
||||||
*
|
*
|
||||||
* FUNCTION: AppEventLoop
|
* FUNCTION: AppEventLoop
|
||||||
*
|
*
|
||||||
* DESCRIPTION: This routine is the event loop for the application.
|
* DESCRIPTION: This routine is the event loop for the application.
|
||||||
*
|
*
|
||||||
* PARAMETERS: nothing
|
* PARAMETERS: nothing
|
||||||
*
|
*
|
||||||
|
@ -249,8 +249,8 @@ static void AppEventLoop(void) {
|
||||||
*
|
*
|
||||||
* DESCRIPTION: This is the main entry point for the application.
|
* DESCRIPTION: This is the main entry point for the application.
|
||||||
*
|
*
|
||||||
* PARAMETERS: cmd - word value specifying the launch code.
|
* PARAMETERS: cmd - word value specifying the launch code.
|
||||||
* cmdPB - pointer to a structure that is associated with the launch code.
|
* cmdPB - pointer to a structure that is associated with the launch code.
|
||||||
* launchFlags - word value providing extra information about the launch.
|
* launchFlags - word value providing extra information about the launch.
|
||||||
*
|
*
|
||||||
* RETURNED: Result of launch
|
* RETURNED: Result of launch
|
||||||
|
@ -324,7 +324,7 @@ static UInt32 ScummVMPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) {
|
||||||
|
|
||||||
case sysAppLaunchCmdNormalLaunch:
|
case sysAppLaunchCmdNormalLaunch:
|
||||||
error = AppStart();
|
error = AppStart();
|
||||||
if (error)
|
if (error)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (!bDirectMode) {
|
if (!bDirectMode) {
|
||||||
|
@ -352,8 +352,8 @@ end:
|
||||||
*
|
*
|
||||||
* DESCRIPTION: This is the main entry point for the application.
|
* DESCRIPTION: This is the main entry point for the application.
|
||||||
*
|
*
|
||||||
* PARAMETERS: cmd - word value specifying the launch code.
|
* PARAMETERS: cmd - word value specifying the launch code.
|
||||||
* cmdPB - pointer to a structure that is associated with the launch code.
|
* cmdPB - pointer to a structure that is associated with the launch code.
|
||||||
* launchFlags - word value providing extra information about the launch.
|
* launchFlags - word value providing extra information about the launch.
|
||||||
* RETURNED: Result of launch
|
* RETURNED: Result of launch
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __START_H__
|
#ifndef __START_H__
|
||||||
#define __START_H__
|
#define __START_H__
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ typedef struct {
|
||||||
|
|
||||||
//skin params
|
//skin params
|
||||||
SkinInfoType skin; // card where is located the skin
|
SkinInfoType skin; // card where is located the skin
|
||||||
Boolean soundClick;
|
Boolean soundClick;
|
||||||
|
|
||||||
Boolean vibrator;
|
Boolean vibrator;
|
||||||
Boolean autoOff;
|
Boolean autoOff;
|
||||||
|
|
|
@ -105,7 +105,7 @@ static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
|
||||||
LocalID dbID;
|
LocalID dbID;
|
||||||
|
|
||||||
LaunchParamType *lp = (LaunchParamType *)cmdPBP;
|
LaunchParamType *lp = (LaunchParamType *)cmdPBP;
|
||||||
|
|
||||||
gVars = lp->gVars;
|
gVars = lp->gVars;
|
||||||
argvP = lp->args.argv;
|
argvP = lp->args.argv;
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ static UInt32 ModulesPalmMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
|
||||||
// MemPtrSetOwner(gVars, ownerID);
|
// MemPtrSetOwner(gVars, ownerID);
|
||||||
// ArgsSetOwner(argvP, ownerID); // will be freed by main(...)
|
// ArgsSetOwner(argvP, ownerID); // will be freed by main(...)
|
||||||
// MemPtrFree(lp); // will be freed by the system on exit
|
// MemPtrFree(lp); // will be freed by the system on exit
|
||||||
|
|
||||||
run(lp->args.argc, argvP);
|
run(lp->args.argc, argvP);
|
||||||
|
|
||||||
cardNo = 0;
|
cardNo = 0;
|
||||||
|
|
|
@ -52,9 +52,9 @@ extern GlobalsType global;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
# define PACE_CLASS_WRAPPER(rv) extern "C" rv
|
# define PACE_CLASS_WRAPPER(rv) extern "C" rv
|
||||||
#else
|
#else
|
||||||
# define PACE_CLASS_WRAPPER(rv) rv
|
# define PACE_CLASS_WRAPPER(rv) rv
|
||||||
#endif
|
#endif
|
||||||
#define PACE_CALLBACK_PTR g_call68KFuncP
|
#define PACE_CALLBACK_PTR g_call68KFuncP
|
||||||
#define PACE_EMULSTATE g_emulStateP
|
#define PACE_EMULSTATE g_emulStateP
|
||||||
|
@ -66,7 +66,7 @@ extern GlobalsType global;
|
||||||
|
|
||||||
#define PACE_PARAMS_INIT() \
|
#define PACE_PARAMS_INIT() \
|
||||||
UInt8 params[] = {
|
UInt8 params[] = {
|
||||||
|
|
||||||
#define PACE_PARAMS_ADD8(param) \
|
#define PACE_PARAMS_ADD8(param) \
|
||||||
(UInt8)(param), \
|
(UInt8)(param), \
|
||||||
0,
|
0,
|
||||||
|
@ -91,7 +91,7 @@ extern GlobalsType global;
|
||||||
static_cast<void *>(PACE_EMULSTATE), \
|
static_cast<void *>(PACE_EMULSTATE), \
|
||||||
PceNativeTrapNo(sysTrapPinsDispatch), \
|
PceNativeTrapNo(sysTrapPinsDispatch), \
|
||||||
NULL, 0)));
|
NULL, 0)));
|
||||||
|
|
||||||
#define PACE_PIN_EXEC(pinTrap, returnType) \
|
#define PACE_PIN_EXEC(pinTrap, returnType) \
|
||||||
PACE_EMULSTATE->regData[2] = pinTrap; \
|
PACE_EMULSTATE->regData[2] = pinTrap; \
|
||||||
return ((returnType)((PACE_CALLBACK_PTR)( \
|
return ((returnType)((PACE_CALLBACK_PTR)( \
|
||||||
|
@ -100,4 +100,4 @@ extern GlobalsType global;
|
||||||
¶ms, \
|
¶ms, \
|
||||||
sizeof(params))));
|
sizeof(params))));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -74,11 +74,11 @@ static void Go() {
|
||||||
int argc;
|
int argc;
|
||||||
|
|
||||||
#ifdef DEBUG_ARM
|
#ifdef DEBUG_ARM
|
||||||
// Tell the debugger we want to enable full debugging
|
// Tell the debugger we want to enable full debugging
|
||||||
UInt32 flags = AdnDebugEnableGet();
|
UInt32 flags = AdnDebugEnableGet();
|
||||||
flags |= kAdnEnableMasterSwitch | kAdnEnableFullDebugging;
|
flags |= kAdnEnableMasterSwitch | kAdnEnableFullDebugging;
|
||||||
AdnDebugEnableSet(flags);
|
AdnDebugEnableSet(flags);
|
||||||
// Tell the debugger where our code lives in memory:
|
// Tell the debugger where our code lives in memory:
|
||||||
AdnDebugNativeRegister(sysFileTApplication, appFileCreator, 'ARMC', 1);
|
AdnDebugNativeRegister(sysFileTApplication, appFileCreator, 'ARMC', 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -102,9 +102,9 @@ static void Go() {
|
||||||
if (HWR_INIT(INIT_VIBRATOR)) gVars->vibrator = RumbleInit();
|
if (HWR_INIT(INIT_VIBRATOR)) gVars->vibrator = RumbleInit();
|
||||||
|
|
||||||
// run ...
|
// run ...
|
||||||
DO_EXIT ( palm_main(argc, argvP); )
|
DO_EXIT ( palm_main(argc, argvP); )
|
||||||
|
|
||||||
// release
|
// release
|
||||||
if (HWR_INIT(INIT_VIBRATOR)) RumbleRelease();
|
if (HWR_INIT(INIT_VIBRATOR)) RumbleRelease();
|
||||||
stdio_release();
|
stdio_release();
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ static void Go() {
|
||||||
Int8 *g_newStack, *g_newStackPos;
|
Int8 *g_newStack, *g_newStackPos;
|
||||||
void *g_oldStack;
|
void *g_oldStack;
|
||||||
|
|
||||||
static asm void *StkSwap(void *newStack ,void *dummy) {
|
static asm void *StkSwap(void *newStack ,void *dummy) {
|
||||||
mov r1, r13
|
mov r1, r13
|
||||||
mov r13, r0
|
mov r13, r0
|
||||||
mov r0, r1
|
mov r0, r1
|
||||||
|
@ -134,7 +134,7 @@ extern UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags) {
|
||||||
g_newStack = (Int8 *)malloc(g_stackSize + 8);
|
g_newStack = (Int8 *)malloc(g_stackSize + 8);
|
||||||
g_newStackPos = (g_newStack + g_stackSize);
|
g_newStackPos = (g_newStack + g_stackSize);
|
||||||
g_newStackPos -= ((UInt32)g_newStackPos & 7);
|
g_newStackPos -= ((UInt32)g_newStackPos & 7);
|
||||||
|
|
||||||
g_oldStack = StkSwap(g_newStackPos, 0);
|
g_oldStack = StkSwap(g_newStackPos, 0);
|
||||||
|
|
||||||
Go();
|
Go();
|
||||||
|
|
|
@ -40,7 +40,7 @@ WinHandle OSystem_PalmOS5::alloc_screen(Coord w, Coord h) {
|
||||||
UInt16 old = WinSetCoordinateSystem(kCoordinatesNative);
|
UInt16 old = WinSetCoordinateSystem(kCoordinatesNative);
|
||||||
winH = WinCreateOffscreenWindow(w, h, nativeFormat, &e);
|
winH = WinCreateOffscreenWindow(w, h, nativeFormat, &e);
|
||||||
WinSetCoordinateSystem(old);
|
WinSetCoordinateSystem(old);
|
||||||
|
|
||||||
return winH;
|
return winH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,9 +162,9 @@ void OSystem_PalmOS5::hotswap_gfx_mode(int mode) {
|
||||||
|
|
||||||
void OSystem_PalmOS5::unload_gfx_mode() {
|
void OSystem_PalmOS5::unload_gfx_mode() {
|
||||||
if (!_gfxLoaded)
|
if (!_gfxLoaded)
|
||||||
return;
|
return;
|
||||||
_gfxLoaded = false;
|
_gfxLoaded = false;
|
||||||
|
|
||||||
// mouse data freed in quit()
|
// mouse data freed in quit()
|
||||||
free(_offScreenP);
|
free(_offScreenP);
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ void OSystem_PalmOS5::unload_gfx_mode() {
|
||||||
WinDeleteWindow(_workScreenH, false);
|
WinDeleteWindow(_workScreenH, false);
|
||||||
if (_overlayH)
|
if (_overlayH)
|
||||||
WinDeleteWindow(_overlayH, false);
|
WinDeleteWindow(_overlayH, false);
|
||||||
|
|
||||||
_workScreenH = NULL;
|
_workScreenH = NULL;
|
||||||
_overlayH = NULL;
|
_overlayH = NULL;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void OSystem_PalmOS5::setCursorPalette(const byte *colors, uint start, uint num)
|
||||||
_mousePal[i + start] = gfxMakeDisplayRGB(colors[0], colors[1], colors[2]);
|
_mousePal[i + start] = gfxMakeDisplayRGB(colors[0], colors[1], colors[2]);
|
||||||
colors += 4;
|
colors += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
_cursorPaletteDisabled = false;
|
_cursorPaletteDisabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void OSystem_PalmOS5::disableCursorPalette(bool disable) {
|
||||||
void OSystem_PalmOS5::draw_mouse() {
|
void OSystem_PalmOS5::draw_mouse() {
|
||||||
if (!_mouseDataP || _mouseDrawn || !_mouseVisible)
|
if (!_mouseDataP || _mouseDrawn || !_mouseVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
byte *src = _mouseDataP;
|
byte *src = _mouseDataP;
|
||||||
|
|
||||||
int x = _mouseCurState.x - _mouseHotspotX;
|
int x = _mouseCurState.x - _mouseHotspotX;
|
||||||
|
@ -145,7 +145,7 @@ void OSystem_PalmOS5::undraw_mouse() {
|
||||||
} else {
|
} else {
|
||||||
byte *dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x;
|
byte *dst = _offScreenP + _mouseOldState.y * _screenWidth + _mouseOldState.x;
|
||||||
byte *bak = _mouseBackupP;
|
byte *bak = _mouseBackupP;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
MemMove(dst, bak, _mouseOldState.w);
|
MemMove(dst, bak, _mouseOldState.w);
|
||||||
dst += _screenWidth;
|
dst += _screenWidth;
|
||||||
|
@ -154,4 +154,4 @@ void OSystem_PalmOS5::undraw_mouse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_mouseDrawn = false;
|
_mouseDrawn = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ SoundExType _soundEx;
|
||||||
static Err sndCallback(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP) {
|
static Err sndCallback(void* UserDataP, SndStreamRef stream, void* bufferP, UInt32 *bufferSizeP) {
|
||||||
SoundExType *_soundEx = (SoundExType *)UserDataP;
|
SoundExType *_soundEx = (SoundExType *)UserDataP;
|
||||||
SoundType *_sound = _soundEx->sound;
|
SoundType *_sound = _soundEx->sound;
|
||||||
|
|
||||||
if (_soundEx->set && _soundEx->size) {
|
if (_soundEx->set && _soundEx->size) {
|
||||||
MemMove(bufferP, _soundEx->dataP, _soundEx->size);
|
MemMove(bufferP, _soundEx->dataP, _soundEx->size);
|
||||||
*bufferSizeP = _soundEx->size;
|
*bufferSizeP = _soundEx->size;
|
||||||
|
@ -53,7 +53,7 @@ static Err sndCallback(void* UserDataP, SndStreamRef stream, void* bufferP, UInt
|
||||||
MemSet(bufferP, 128, 0);
|
MemSet(bufferP, 128, 0);
|
||||||
*bufferSizeP = 128;
|
*bufferSizeP = 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
return errNone;
|
return errNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#define DISABLE_SAGA
|
#define DISABLE_SAGA
|
||||||
#define DISABLE_KYRA
|
#define DISABLE_KYRA
|
||||||
#define DISABLE_AWE
|
#define DISABLE_AWE
|
||||||
#define DISABLE_GOB
|
#define DISABLE_GOB
|
||||||
#define DISABLE_LURE
|
#define DISABLE_LURE
|
||||||
#define DISABLE_CINE
|
#define DISABLE_CINE
|
||||||
#define DISABLE_AGI
|
#define DISABLE_AGI
|
||||||
|
|
|
@ -86,7 +86,7 @@ bool OSystem_PalmZodiac::check_event(Common::Event &event, EventPtr ev) {
|
||||||
if (_sound.active)
|
if (_sound.active)
|
||||||
SndStreamPause(_soundEx.handle, true);
|
SndStreamPause(_soundEx.handle, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case vchrLateWakeup:
|
case vchrLateWakeup:
|
||||||
// resume the sound thread if any
|
// resume the sound thread if any
|
||||||
if (_sound.active)
|
if (_sound.active)
|
||||||
|
|
|
@ -175,7 +175,7 @@ void OSystem_PalmZodiac::unload_gfx_mode() {
|
||||||
Err e;
|
Err e;
|
||||||
|
|
||||||
if (!_gfxLoaded)
|
if (!_gfxLoaded)
|
||||||
return;
|
return;
|
||||||
_gfxLoaded = false;
|
_gfxLoaded = false;
|
||||||
|
|
||||||
if (_tmpScreenP) {
|
if (_tmpScreenP) {
|
||||||
|
@ -186,7 +186,7 @@ void OSystem_PalmZodiac::unload_gfx_mode() {
|
||||||
e = TwGfxFreeSurface(_overlayP);
|
e = TwGfxFreeSurface(_overlayP);
|
||||||
e = TwGfxClose(_gfxH);
|
e = TwGfxClose(_gfxH);
|
||||||
|
|
||||||
UInt32 depth = 8;
|
UInt32 depth = 8;
|
||||||
WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
|
WinScreenMode(winScreenModeSet, NULL, NULL, &depth, NULL);
|
||||||
clearScreen();
|
clearScreen();
|
||||||
|
|
||||||
|
@ -246,11 +246,11 @@ void OSystem_PalmZodiac::updateScreen() {
|
||||||
}
|
}
|
||||||
e = TwGfxDrawBitmap(_tmpScreenP, &pos, &_srcBmp);
|
e = TwGfxDrawBitmap(_tmpScreenP, &pos, &_srcBmp);
|
||||||
e = TwGfxWaitForVBlank(_gfxH);
|
e = TwGfxWaitForVBlank(_gfxH);
|
||||||
e = TwGfxStretchBlt2(_palmScreenP, &dst, _tmpScreenP, &_srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0));
|
e = TwGfxStretchBlt2(_palmScreenP, &dst, _tmpScreenP, &_srcRect, twGfxStretchFast| (gVars->filter ? twGfxStretchSmooth : 0));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
TwGfxPointType pos = {_srcPos.x, _srcPos.y};
|
TwGfxPointType pos = {_srcPos.x, _srcPos.y};
|
||||||
|
|
||||||
if (_new_shake_pos != _current_shake_pos) {
|
if (_new_shake_pos != _current_shake_pos) {
|
||||||
if (_new_shake_pos != 0) {
|
if (_new_shake_pos != 0) {
|
||||||
TwGfxRectType r = { _screenOffset.x, _screenOffset.y, _screenWidth, _new_shake_pos };
|
TwGfxRectType r = { _screenOffset.x, _screenOffset.y, _screenWidth, _new_shake_pos };
|
||||||
|
@ -263,7 +263,7 @@ void OSystem_PalmZodiac::updateScreen() {
|
||||||
e = TwGfxDrawBitmap(_palmScreenP, &pos, &_srcBmp);
|
e = TwGfxDrawBitmap(_palmScreenP, &pos, &_srcBmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// undraw the mouse
|
// undraw the mouse
|
||||||
undraw_mouse();
|
undraw_mouse();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
void OSystem_PalmZodiac::draw_mouse() {
|
void OSystem_PalmZodiac::draw_mouse() {
|
||||||
if (!_mouseDataP || _mouseDrawn || !_mouseVisible)
|
if (!_mouseDataP || _mouseDrawn || !_mouseVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
byte *src = _mouseDataP;
|
byte *src = _mouseDataP;
|
||||||
|
|
||||||
int x = _mouseCurState.x - _mouseHotspotX;
|
int x = _mouseCurState.x - _mouseHotspotX;
|
||||||
|
|
|
@ -43,7 +43,7 @@ void OSystem_PalmZodiac::clearOverlay() {
|
||||||
void OSystem_PalmZodiac::grabOverlay(OverlayColor *buf, int pitch) {
|
void OSystem_PalmZodiac::grabOverlay(OverlayColor *buf, int pitch) {
|
||||||
Err e;
|
Err e;
|
||||||
OverlayColor *src;
|
OverlayColor *src;
|
||||||
|
|
||||||
e = TwGfxLockSurface(_overlayP, (void **)&src);
|
e = TwGfxLockSurface(_overlayP, (void **)&src);
|
||||||
int h = _screenHeight;
|
int h = _screenHeight;
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
.globl _flush_instruction_cache
|
.globl _flush_instruction_cache
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
|
|
||||||
! Flush the SH instruction cache
|
! Flush the SH instruction cache
|
||||||
|
|
|
@ -161,7 +161,7 @@ void OSystem_Dreamcast::setCursorPalette(const byte *colors, uint start, uint nu
|
||||||
|
|
||||||
void OSystem_Dreamcast::disableCursorPalette(bool disable)
|
void OSystem_Dreamcast::disableCursorPalette(bool disable)
|
||||||
{
|
{
|
||||||
_enable_cursor_palette = !disable;
|
_enable_cursor_palette = !disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)
|
void OSystem_Dreamcast::grabPalette(byte *colors, uint start, uint num)
|
||||||
|
|
|
@ -226,10 +226,10 @@ static int findGames(Game *games, int max)
|
||||||
else
|
else
|
||||||
files.push_back(*entry);
|
files.push_back(*entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameList candidates;
|
GameList candidates;
|
||||||
detectGames(files, candidates);
|
detectGames(files, candidates);
|
||||||
|
|
||||||
for (GameList::const_iterator ge = candidates.begin();
|
for (GameList::const_iterator ge = candidates.begin();
|
||||||
ge != candidates.end(); ++ge)
|
ge != candidates.end(); ++ge)
|
||||||
if (curr_game < max) {
|
if (curr_game < max) {
|
||||||
|
@ -237,7 +237,7 @@ static int findGames(Game *games, int max)
|
||||||
strcpy(games[curr_game].dir, dirs[curr_dir-1].name);
|
strcpy(games[curr_game].dir, dirs[curr_dir-1].name);
|
||||||
if (uniqueGame(games[curr_game].filename_base,
|
if (uniqueGame(games[curr_game].filename_base,
|
||||||
games[curr_game].dir, games, curr_game)) {
|
games[curr_game].dir, games, curr_game)) {
|
||||||
|
|
||||||
strcpy(games[curr_game].text, ge->description().c_str());
|
strcpy(games[curr_game].text, ge->description().c_str());
|
||||||
#if 0
|
#if 0
|
||||||
printf("Registered game <%s> in <%s> <%s> because of <%s> <*>\n",
|
printf("Registered game <%s> in <%s> <%s> because of <%s> <*>\n",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# TARGET is the name of the output, if this ends with _mb generates a multiboot image
|
# TARGET is the name of the output, if this ends with _mb generates a multiboot image
|
||||||
# BUILD is the directory where object files & intermediate files will be placed
|
# BUILD is the directory where object files & intermediate files will be placed
|
||||||
|
@ -16,7 +16,7 @@ INCLUDES := include build
|
||||||
|
|
||||||
# Enable support for debugger (must be the same as in the arm9 makefile)
|
# Enable support for debugger (must be the same as in the arm9 makefile)
|
||||||
#USE_DEBUGGER = 1
|
#USE_DEBUGGER = 1
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -34,7 +34,7 @@ CFLAGS += $(INCLUDE) -DARM7
|
||||||
ifdef USE_DEBUGGER
|
ifdef USE_DEBUGGER
|
||||||
CFLAGS += -DUSE_DEBUGGER
|
CFLAGS += -DUSE_DEBUGGER
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
CXXFLAGS := $(CFLAGS) -fno-exceptions -fno-rtti
|
CXXFLAGS := $(CFLAGS) -fno-exceptions -fno-rtti
|
||||||
ASFLAGS := -g $(ARCH)
|
ASFLAGS := -g $(ARCH)
|
||||||
|
@ -44,12 +44,12 @@ LDFLAGS := -g $(ARCH) -mno-fpu
|
||||||
# path to tools - this can be deleted if you set the path in windows
|
# path to tools - this can be deleted if you set the path in windows
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# export PATH := /d/dev/ds/devkitARM_r11/bin:/bin
|
# export PATH := /d/dev/ds/devkitARM_r11/bin:/bin
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# PATH to ndslib - just make a system variable called NDSLIBPATH and be done with it
|
# PATH to ndslib - just make a system variable called NDSLIBPATH and be done with it
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# NDSLIBPATH := /d/dev/ds/ndslib/
|
# NDSLIBPATH := /d/dev/ds/ndslib/
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# the prefix on the compiler executables
|
# the prefix on the compiler executables
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -62,26 +62,26 @@ LIBS := -lnds7
|
||||||
ifdef USE_DEBUGGER
|
ifdef USE_DEBUGGER
|
||||||
LIBS += -ldswifi7
|
LIBS += -ldswifi7
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# list of directories containing libraries, this must be the top level containing
|
# list of directories containing libraries, this must be the top level containing
|
||||||
# include and lib
|
# include and lib
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
LIBDIRS := /home/neil/devkitpror21/libnds home/neil/devkitpror21/libnds/nds
|
LIBDIRS := /home/neil/devkitpror21/libnds home/neil/devkitpror21/libnds/nds
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# no real need to edit anything past this point unless you need to add additional
|
# no real need to edit anything past this point unless you need to add additional
|
||||||
# rules for different file extensions
|
# rules for different file extensions
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
export OUTPUT := $(CURDIR)/$(TARGET)
|
export OUTPUT := $(CURDIR)/$(TARGET)
|
||||||
|
|
||||||
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
||||||
|
|
||||||
export CC := $(PREFIX)gcc
|
export CC := $(PREFIX)gcc
|
||||||
export CXX := $(PREFIX)g++
|
export CXX := $(PREFIX)g++
|
||||||
export AR := $(PREFIX)ar
|
export AR := $(PREFIX)ar
|
||||||
|
@ -91,8 +91,8 @@ export OBJCOPY := $(PREFIX)objcopy
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
export LD := $(CXX)
|
export LD := $(CXX)
|
||||||
#export LD := $(CC)
|
#export LD := $(CC)
|
||||||
|
|
||||||
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
||||||
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
||||||
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
||||||
PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx)))
|
PCXFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.pcx)))
|
||||||
|
@ -102,60 +102,60 @@ RAWFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.raw)))
|
||||||
MAPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.map)))
|
MAPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.map)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export OFILES := $(MAPFILES:.map=.o) $(RAWFILES:.raw=.o) $(PALFILES:.pal=.o) $(BINFILES:.bin=.o) $(PCXFILES:.pcx=.o)\
|
export OFILES := $(MAPFILES:.map=.o) $(RAWFILES:.raw=.o) $(PALFILES:.pal=.o) $(BINFILES:.bin=.o) $(PCXFILES:.pcx=.o)\
|
||||||
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
|
||||||
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) -I- -I$(CURDIR)/../commoninclude\
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) -I- -I$(CURDIR)/../commoninclude\
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
||||||
$(foreach dir,$(LIBDIRS),-I$(dir)/include/nds)\
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include/nds)\
|
||||||
-I$(CURDIR)/$(BUILD) -I$(CURDIR)/source/libcartreset
|
-I$(CURDIR)/$(BUILD) -I$(CURDIR)/source/libcartreset
|
||||||
|
|
||||||
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
||||||
|
|
||||||
.PHONY: $(BUILD) clean
|
.PHONY: $(BUILD) clean
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
$(BUILD):
|
$(BUILD):
|
||||||
@[ -d $@ ] || mkdir -p $@
|
@[ -d $@ ] || mkdir -p $@
|
||||||
@echo $(OFILES)
|
@echo $(OFILES)
|
||||||
@echo $(CFILES)
|
@echo $(CFILES)
|
||||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
clean:
|
clean:
|
||||||
@echo clean ...$(TARGET)
|
@echo clean ...$(TARGET)
|
||||||
@rm -fr $(BUILD) *.bin
|
@rm -fr $(BUILD) *.bin
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
else
|
else
|
||||||
|
|
||||||
DEPENDS := $(OFILES:.o=.d)
|
DEPENDS := $(OFILES:.o=.d)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
# main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
$(OUTPUT).bin : $(OUTPUT).elf
|
$(OUTPUT).bin : $(OUTPUT).elf
|
||||||
|
|
||||||
$(OUTPUT).elf : $(OFILES)
|
$(OUTPUT).elf : $(OFILES)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.bin: %.elf
|
%.bin: %.elf
|
||||||
@echo built ... $(notdir $@)
|
@echo built ... $(notdir $@)
|
||||||
@$(OBJCOPY) -O binary $(TARGET).elf $@
|
@$(OBJCOPY) -O binary $(TARGET).elf $@
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.elf:
|
%.elf:
|
||||||
echo ELF
|
echo ELF
|
||||||
@echo $(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf
|
@echo $(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf
|
||||||
@$(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf
|
@$(LD) $(LDFLAGS) -specs=ds_arm7.specs $(OFILES) $(LIBPATHS) $(LIBS) -o $(TARGET).elf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# Compile Targets for C/C++
|
# Compile Targets for C/C++
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -166,20 +166,20 @@ $(OUTPUT).elf : $(OFILES)
|
||||||
@echo $(CXX) -MM $(CXXFLAGS) -o $*.d $<
|
@echo $(CXX) -MM $(CXXFLAGS) -o $*.d $<
|
||||||
@$(CXX) -MM $(CXXFLAGS) -o $*.d $<
|
@$(CXX) -MM $(CXXFLAGS) -o $*.d $<
|
||||||
@$(CXX) $(CXXFLAGS) -c $< -o$@
|
@$(CXX) $(CXXFLAGS) -c $< -o$@
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.c
|
%.o : %.c
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@echo $(CC) $(CFLAGS) -c $< -o$@
|
@echo $(CC) $(CFLAGS) -c $< -o$@
|
||||||
@$(CC) -MM $(CFLAGS) -o $*.d $<
|
@$(CC) -MM $(CFLAGS) -o $*.d $<
|
||||||
@$(CC) $(CFLAGS) -c $< -o$@
|
@$(CC) $(CFLAGS) -c $< -o$@
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.s
|
%.o : %.s
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(CC) -MM $(CFLAGS) -o $*.d $<
|
@$(CC) -MM $(CFLAGS) -o $*.d $<
|
||||||
@$(CC) $(ASFLAGS) -c $< -o$@
|
@$(CC) $(ASFLAGS) -c $< -o$@
|
||||||
|
|
||||||
define bin2o
|
define bin2o
|
||||||
cp $(<) $(*).tmp
|
cp $(<) $(*).tmp
|
||||||
$(OBJCOPY) -I binary -O elf32-littlearm -B arm \
|
$(OBJCOPY) -I binary -O elf32-littlearm -B arm \
|
||||||
|
@ -192,31 +192,31 @@ define bin2o
|
||||||
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
echo "extern const u32" $(*)_size[]";" >> $(*).h
|
||||||
rm $(*).tmp
|
rm $(*).tmp
|
||||||
endef
|
endef
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.pcx
|
%.o : %.pcx
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.bin
|
%.o : %.bin
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.raw
|
%.o : %.raw
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.pal
|
%.o : %.pal
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.map
|
%.o : %.map
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -229,9 +229,9 @@ endef
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
|
|
||||||
-include $(DEPENDS)
|
-include $(DEPENDS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------
|
||||||
endif
|
endif
|
||||||
#---------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -43,7 +43,7 @@ bool cartSetMenuMode(u32 _deviceType)
|
||||||
tmp = *(vu16*)(0x08800612);
|
tmp = *(vu16*)(0x08800612);
|
||||||
tmp = *(vu16*)(0x08000000);
|
tmp = *(vu16*)(0x08000000);
|
||||||
tmp = *(vu16*)(0x08801B66);
|
tmp = *(vu16*)(0x08801B66);
|
||||||
tmp = *(vu16*)(0x08000000 + (mode << 1));
|
tmp = *(vu16*)(0x08000000 + (mode << 1));
|
||||||
tmp = *(vu16*)(0x0800080E);
|
tmp = *(vu16*)(0x0800080E);
|
||||||
tmp = *(vu16*)(0x08000000);
|
tmp = *(vu16*)(0x08000000);
|
||||||
|
|
||||||
|
|
|
@ -53,5 +53,5 @@ void cartExecute();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
//#define USE_LIBCARTRESET
|
//#define USE_LIBCARTRESET
|
||||||
|
|
||||||
#include <nds.h>
|
#include <nds.h>
|
||||||
|
|
||||||
#include <bios.h>
|
#include <bios.h>
|
||||||
#include <arm7/touch.h>
|
#include <arm7/touch.h>
|
||||||
#include <arm7/clock.h>
|
#include <arm7/clock.h>
|
||||||
|
@ -113,12 +113,12 @@ void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8
|
||||||
} else {
|
} else {
|
||||||
channel = 0;
|
channel = 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (channel > 1) channel = 1;
|
if (channel > 1) channel = 1;
|
||||||
|
|
||||||
bytes &= ~7; // Multiple of 4 bytes!
|
bytes &= ~7; // Multiple of 4 bytes!
|
||||||
// bytes += 4;
|
// bytes += 4;
|
||||||
|
|
||||||
SCHANNEL_CR(channel) = 0;
|
SCHANNEL_CR(channel) = 0;
|
||||||
SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
|
SCHANNEL_TIMER(channel) = SOUND_FREQ(sampleRate);
|
||||||
SCHANNEL_SOURCE(channel) = ((uint32) (data));
|
SCHANNEL_SOURCE(channel) = ((uint32) (data));
|
||||||
|
@ -130,7 +130,7 @@ void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8
|
||||||
SCHANNEL_SOURCE(channel + 2) = ((uint32) (data));
|
SCHANNEL_SOURCE(channel + 2) = ((uint32) (data));
|
||||||
SCHANNEL_LENGTH(channel + 2) = ((bytes & 0x7FFFFFFF) >> 2);
|
SCHANNEL_LENGTH(channel + 2) = ((bytes & 0x7FFFFFFF) >> 2);
|
||||||
SCHANNEL_REPEAT_POINT(channel + 2) = 0;
|
SCHANNEL_REPEAT_POINT(channel + 2) = 0;
|
||||||
|
|
||||||
uint32 flags = SCHANNEL_ENABLE | SOUND_VOL(vol) | SOUND_PAN(pan);
|
uint32 flags = SCHANNEL_ENABLE | SOUND_VOL(vol) | SOUND_PAN(pan);
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
@ -139,21 +139,21 @@ void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8
|
||||||
flags |= SOUND_REPEAT;// | (1 << 15);
|
flags |= SOUND_REPEAT;// | (1 << 15);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0: {
|
case 0: {
|
||||||
flags |= SOUND_16BIT;
|
flags |= SOUND_16BIT;
|
||||||
flags |= SOUND_REPEAT;// | (1 << 15);
|
flags |= SOUND_REPEAT;// | (1 << 15);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 2: {
|
case 2: {
|
||||||
flags |= SOUND_FORMAT_ADPCM;
|
flags |= SOUND_FORMAT_ADPCM;
|
||||||
flags |= SOUND_ONE_SHOT;// | (1 << 15);
|
flags |= SOUND_ONE_SHOT;// | (1 << 15);
|
||||||
|
|
||||||
SCHANNEL_SOURCE(channel) = (unsigned int) IPC->adpcm.buffer[0];
|
SCHANNEL_SOURCE(channel) = (unsigned int) IPC->adpcm.buffer[0];
|
||||||
//bytes += 32;
|
//bytes += 32;
|
||||||
SCHANNEL_LENGTH(channel) = (((bytes + 4) & 0x7FFFFFFF) >> 2);
|
SCHANNEL_LENGTH(channel) = (((bytes + 4) & 0x7FFFFFFF) >> 2);
|
||||||
|
|
||||||
SCHANNEL_CR(channel + 1) = 0;
|
SCHANNEL_CR(channel + 1) = 0;
|
||||||
SCHANNEL_SOURCE(channel + 1) = (unsigned int) IPC->adpcm.buffer[0];
|
SCHANNEL_SOURCE(channel + 1) = (unsigned int) IPC->adpcm.buffer[0];
|
||||||
SCHANNEL_LENGTH(channel + 1) = (((bytes + 4) & 0x7FFFFFFF) >> 2);
|
SCHANNEL_LENGTH(channel + 1) = (((bytes + 4) & 0x7FFFFFFF) >> 2);
|
||||||
|
@ -165,16 +165,16 @@ void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (bytes & 0x80000000) {
|
// if (bytes & 0x80000000) {
|
||||||
// flags |= SOUND_REPEAT;
|
// flags |= SOUND_REPEAT;
|
||||||
// } else {
|
// } else {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
soundData = (vu8* ) data;
|
soundData = (vu8* ) data;
|
||||||
|
|
||||||
SCHANNEL_CR(channel) = flags;
|
SCHANNEL_CR(channel) = flags;
|
||||||
|
@ -186,11 +186,11 @@ void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8
|
||||||
for (volatile int i = 0; i < 16384 * 2; i++) {
|
for (volatile int i = 0; i < 16384 * 2; i++) {
|
||||||
// Delay loop - this makes everything stay in sync!
|
// Delay loop - this makes everything stay in sync!
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMER0_CR = 0;
|
TIMER0_CR = 0;
|
||||||
TIMER0_DATA = SOUND_FREQ(sampleRate) * 2;
|
TIMER0_DATA = SOUND_FREQ(sampleRate) * 2;
|
||||||
TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1;
|
TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1;
|
||||||
|
|
||||||
TIMER1_CR = 0;
|
TIMER1_CR = 0;
|
||||||
TIMER1_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer
|
TIMER1_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer
|
||||||
TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
|
TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
|
||||||
|
@ -200,19 +200,19 @@ void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8
|
||||||
for (volatile int i = 0; i < 16384 * 2; i++) {
|
for (volatile int i = 0; i < 16384 * 2; i++) {
|
||||||
// Delay loop - this makes everything stay in sync!
|
// Delay loop - this makes everything stay in sync!
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMER2_CR = 0;
|
TIMER2_CR = 0;
|
||||||
TIMER2_DATA = SOUND_FREQ(sampleRate) * 2;
|
TIMER2_DATA = SOUND_FREQ(sampleRate) * 2;
|
||||||
TIMER2_CR = TIMER_ENABLE | TIMER_DIV_1;
|
TIMER2_CR = TIMER_ENABLE | TIMER_DIV_1;
|
||||||
|
|
||||||
TIMER3_CR = 0;
|
TIMER3_CR = 0;
|
||||||
TIMER3_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer
|
TIMER3_DATA = 65536 - ((bytes & 0x7FFFFFFF) >> 3); // Trigger four times during the length of the buffer
|
||||||
TIMER3_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
|
TIMER3_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
|
||||||
|
|
||||||
for (int r = 0; r < 4; r++) {
|
for (int r = 0; r < 4; r++) {
|
||||||
// IPC->streamFillNeeded[r] = true;
|
// IPC->streamFillNeeded[r] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC->streamPlayingSection = 0;
|
IPC->streamPlayingSection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ void startSound(int sampleRate, const void* data, uint32 bytes, u8 channel=0, u8
|
||||||
// IPC->fillSoundFirstHalf = true;
|
// IPC->fillSoundFirstHalf = true;
|
||||||
// IPC->fillSoundSecondHalf = true;
|
// IPC->fillSoundSecondHalf = true;
|
||||||
// soundFirstHalf = true;
|
// soundFirstHalf = true;
|
||||||
|
|
||||||
// REG_IME = IME_ENABLE;
|
// REG_IME = IME_ENABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ uint16 powerManagerWrite(uint32 command, u32 data, bool enable) {
|
||||||
REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz;
|
REG_SPICNT = SPI_ENABLE | SPI_BAUD_1MHz;
|
||||||
REG_SPIDATA = 0;
|
REG_SPIDATA = 0;
|
||||||
SerialWaitBusy();
|
SerialWaitBusy();
|
||||||
|
|
||||||
result = REG_SPIDATA & 0xFF;
|
result = REG_SPIDATA & 0xFF;
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,15 +277,15 @@ void performSleep() {
|
||||||
IRQ_HANDLER = DummyHandler;
|
IRQ_HANDLER = DummyHandler;
|
||||||
IF = ~0;
|
IF = ~0;
|
||||||
IME = 1;
|
IME = 1;
|
||||||
|
|
||||||
|
|
||||||
// Now save which interrupts are enabled, then set only the screens unfolding
|
// Now save which interrupts are enabled, then set only the screens unfolding
|
||||||
// interrupt to be enabled, so that the first interrupt that happens is the
|
// interrupt to be enabled, so that the first interrupt that happens is the
|
||||||
// one I want.
|
// one I want.
|
||||||
int saveInts = IE;
|
int saveInts = IE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IE = IRQ_TIMER0; // Screens unfolding interrupt
|
IE = IRQ_TIMER0; // Screens unfolding interrupt
|
||||||
|
|
||||||
// Now call the sleep function in the bios
|
// Now call the sleep function in the bios
|
||||||
|
@ -294,26 +294,26 @@ void performSleep() {
|
||||||
TIMER0_CR = 0;
|
TIMER0_CR = 0;
|
||||||
TIMER0_DATA = TIMER_FREQ(20);
|
TIMER0_DATA = TIMER_FREQ(20);
|
||||||
TIMER0_CR = TIMER_ENABLE | TIMER_DIV_64;
|
TIMER0_CR = TIMER_ENABLE | TIMER_DIV_64;
|
||||||
|
|
||||||
swiDelay(100);
|
swiDelay(100);
|
||||||
|
|
||||||
swiSleep();
|
swiSleep();
|
||||||
|
|
||||||
swiDelay(100);
|
swiDelay(100);
|
||||||
|
|
||||||
powerManagerWrite(0, 0x30, b = !b);
|
powerManagerWrite(0, 0x30, b = !b);
|
||||||
} while (!(TIMER0_CR & TIMER_ENABLE));
|
} while (!(TIMER0_CR & TIMER_ENABLE));
|
||||||
|
|
||||||
TIMER0_CR = 0;
|
TIMER0_CR = 0;
|
||||||
|
|
||||||
// We're back from sleep, now restore the interrupt state and IRQ handler
|
// We're back from sleep, now restore the interrupt state and IRQ handler
|
||||||
IRQ_HANDLER = (void (*)()) irq;
|
IRQ_HANDLER = (void (*)()) irq;
|
||||||
IE = saveInts;
|
IE = saveInts;
|
||||||
IF = ~0;
|
IF = ~0;
|
||||||
IME = 1;
|
IME = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
powerManagerWrite(0, 0x30, false);
|
powerManagerWrite(0, 0x30, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,29 +322,29 @@ void performSleep() {
|
||||||
powerManagerWrite(0, 0x30, true);
|
powerManagerWrite(0, 0x30, true);
|
||||||
|
|
||||||
IPC->performArm9SleepMode = true; // Tell ARM9 to sleep
|
IPC->performArm9SleepMode = true; // Tell ARM9 to sleep
|
||||||
|
|
||||||
// u32 irq = (u32) IRQ_HANDLER;
|
// u32 irq = (u32) IRQ_HANDLER;
|
||||||
// IRQ_HANDLER = DummyHandler;
|
// IRQ_HANDLER = DummyHandler;
|
||||||
// POWER_CR &= ~POWER_SOUND;
|
// POWER_CR &= ~POWER_SOUND;
|
||||||
|
|
||||||
// int saveInts = REG_IE;
|
// int saveInts = REG_IE;
|
||||||
// REG_IE = (1 << 22) | IRQ_VBLANK; // Lid open
|
// REG_IE = (1 << 22) | IRQ_VBLANK; // Lid open
|
||||||
// *((u32*) (0x0380FFF8)) = *((u32*) (0x0380FFF8)) | (REG_IE & REG_IF);
|
// *((u32*) (0x0380FFF8)) = *((u32*) (0x0380FFF8)) | (REG_IE & REG_IF);
|
||||||
// VBLANK_INTR_WAIT_FLAGS = IRQ_VBLANK;
|
// VBLANK_INTR_WAIT_FLAGS = IRQ_VBLANK;
|
||||||
|
|
||||||
|
|
||||||
int r = 0;
|
int r = 0;
|
||||||
while ((REG_KEYXY & (1 << 7))) { // Wait for lid to open
|
while ((REG_KEYXY & (1 << 7))) { // Wait for lid to open
|
||||||
swiDelay(1000000);
|
swiDelay(1000000);
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IRQ_HANDLER = (void (*)()) irq;
|
// IRQ_HANDLER = (void (*)()) irq;
|
||||||
IPC->performArm9SleepMode = false; // Tell ARM9 to wake up
|
IPC->performArm9SleepMode = false; // Tell ARM9 to wake up
|
||||||
// REG_IE = saveInts;
|
// REG_IE = saveInts;
|
||||||
|
|
||||||
// POWER_CR |= POWER_SOUND;
|
// POWER_CR |= POWER_SOUND;
|
||||||
|
|
||||||
powerManagerWrite(0, 0x30, false);
|
powerManagerWrite(0, 0x30, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,33 +353,33 @@ void powerOff() {
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InterruptTimer1() {
|
void InterruptTimer1() {
|
||||||
|
|
||||||
IPC->fillNeeded[playingSection] = true;
|
IPC->fillNeeded[playingSection] = true;
|
||||||
soundFilled[playingSection] = false;
|
soundFilled[playingSection] = false;
|
||||||
|
|
||||||
if (playingSection == 3) {
|
if (playingSection == 3) {
|
||||||
// IME = IME_DISABLED;
|
// IME = IME_DISABLED;
|
||||||
|
|
||||||
// while (SCHANNEL_CR(0) & SCHANNEL_ENABLE) {
|
// while (SCHANNEL_CR(0) & SCHANNEL_ENABLE) {
|
||||||
// }
|
// }
|
||||||
// SCHANNEL_CR(0) &= ~SCHANNEL_ENABLE;
|
// SCHANNEL_CR(0) &= ~SCHANNEL_ENABLE;
|
||||||
|
|
||||||
// SCHANNEL_CR(0) |= SCHANNEL_ENABLE;
|
// SCHANNEL_CR(0) |= SCHANNEL_ENABLE;
|
||||||
// TIMER1_CR = 0;
|
// TIMER1_CR = 0;
|
||||||
// TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
|
// TIMER1_CR = TIMER_ENABLE | TIMER_IRQ_REQ | TIMER_CASCADE;
|
||||||
|
|
||||||
playingSection = 0;
|
playingSection = 0;
|
||||||
|
|
||||||
// IME = IME_ENABLED;
|
// IME = IME_ENABLED;
|
||||||
} else {
|
} else {
|
||||||
playingSection++;
|
playingSection++;
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC->playingSection = playingSection;
|
IPC->playingSection = playingSection;
|
||||||
|
|
||||||
/* for (int r = 0; r < 4; r++) {
|
/* for (int r = 0; r < 4; r++) {
|
||||||
//if ((!soundFilled[r]) && (!IPC->fillNeeded[playingSection])) {
|
//if ((!soundFilled[r]) && (!IPC->fillNeeded[playingSection])) {
|
||||||
memcpy((void *) (soundBuffer + (r * 1024)), (void *) (arm9Buffer + (r * 1024)), 1024);
|
memcpy((void *) (soundBuffer + (r * 1024)), (void *) (arm9Buffer + (r * 1024)), 1024);
|
||||||
|
@ -391,21 +391,21 @@ void InterruptTimer1() {
|
||||||
soundFilled[r] = true;
|
soundFilled[r] = true;
|
||||||
//}
|
//}
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterruptTimer3() {
|
void InterruptTimer3() {
|
||||||
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
|
||||||
|
|
||||||
IPC->streamFillNeeded[IPC->streamPlayingSection] = true;
|
IPC->streamFillNeeded[IPC->streamPlayingSection] = true;
|
||||||
|
|
||||||
if (IPC->streamPlayingSection == 3) {
|
if (IPC->streamPlayingSection == 3) {
|
||||||
IPC->streamPlayingSection = 0;
|
IPC->streamPlayingSection = 0;
|
||||||
} else {
|
} else {
|
||||||
IPC->streamPlayingSection++;
|
IPC->streamPlayingSection++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IPC->adpcm.semaphore = false;
|
IPC->adpcm.semaphore = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,10 +416,10 @@ void InterruptTimer3() {
|
||||||
// static int16 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1;
|
// static int16 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1;
|
||||||
// static int16 CNTRL_WIDTH = TOUCH_CNTRL_X2 - (TOUCH_CNTRL_X1 - 8);
|
// static int16 CNTRL_WIDTH = TOUCH_CNTRL_X2 - (TOUCH_CNTRL_X1 - 8);
|
||||||
// static int16 CNTRL_HEIGHT = TOUCH_CNTRL_Y2 - (TOUCH_CNTRL_Y1 - 8);
|
// static int16 CNTRL_HEIGHT = TOUCH_CNTRL_Y2 - (TOUCH_CNTRL_Y1 - 8);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InterruptVBlank() {
|
void InterruptVBlank() {
|
||||||
uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0, batt=0, aux=0;
|
uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0, batt=0, aux=0;
|
||||||
int t1=0, t2=0;
|
int t1=0, t2=0;
|
||||||
|
@ -428,7 +428,7 @@ void InterruptTimer3() {
|
||||||
static int heartbeat = 0;
|
static int heartbeat = 0;
|
||||||
// Update the heartbeat
|
// Update the heartbeat
|
||||||
heartbeat++;
|
heartbeat++;
|
||||||
|
|
||||||
// Read the X/Y buttons and the /PENIRQ line
|
// Read the X/Y buttons and the /PENIRQ line
|
||||||
but = REG_KEYXY;
|
but = REG_KEYXY;
|
||||||
if (!(but & 0x40)) {
|
if (!(but & 0x40)) {
|
||||||
|
@ -437,28 +437,28 @@ void InterruptTimer3() {
|
||||||
|
|
||||||
// x = touchRead(TSC_MEASURE_X);
|
// x = touchRead(TSC_MEASURE_X);
|
||||||
// y = touchRead(TSC_MEASURE_Y);
|
// y = touchRead(TSC_MEASURE_Y);
|
||||||
|
|
||||||
x = p.x;
|
x = p.x;
|
||||||
y = p.y;
|
y = p.y;
|
||||||
|
|
||||||
xpx = p.px;
|
xpx = p.px;
|
||||||
ypx = p.py;
|
ypx = p.py;
|
||||||
|
|
||||||
// xpx = ( ((SCREEN_WIDTH -60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X;
|
// xpx = ( ((SCREEN_WIDTH -60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X;
|
||||||
// ypx = ( ((SCREEN_HEIGHT-60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y;
|
// ypx = ( ((SCREEN_HEIGHT-60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y;
|
||||||
|
|
||||||
// xpx = (IPC->touchX - (int16) TOUCH_CAL_X1) * CNTRL_WIDTH / TOUCH_WIDTH + (int16) (TOUCH_CNTRL_X1 - 8);
|
|
||||||
// ypx = (IPC->touchY - (int16) TOUCH_CAL_Y1) * CNTRL_HEIGHT / TOUCH_HEIGHT + (int16) (TOUCH_CNTRL_Y1 - 8);
|
|
||||||
|
|
||||||
|
// xpx = (IPC->touchX - (int16) TOUCH_CAL_X1) * CNTRL_WIDTH / TOUCH_WIDTH + (int16) (TOUCH_CNTRL_X1 - 8);
|
||||||
|
// ypx = (IPC->touchY - (int16) TOUCH_CAL_Y1) * CNTRL_HEIGHT / TOUCH_HEIGHT + (int16) (TOUCH_CNTRL_Y1 - 8);
|
||||||
|
|
||||||
|
|
||||||
z1 = touchRead(TSC_MEASURE_Z1);
|
z1 = touchRead(TSC_MEASURE_Z1);
|
||||||
z2 = touchRead(TSC_MEASURE_Z2);
|
z2 = touchRead(TSC_MEASURE_Z2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (but & (1 << 7)) { // Check if screen is folded
|
if (but & (1 << 7)) { // Check if screen is folded
|
||||||
needSleep = true;
|
needSleep = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
batt = touchRead(TSC_MEASURE_BATTERY);
|
batt = touchRead(TSC_MEASURE_BATTERY);
|
||||||
aux = touchRead(TSC_MEASURE_AUX);
|
aux = touchRead(TSC_MEASURE_AUX);
|
||||||
|
@ -466,11 +466,11 @@ void InterruptTimer3() {
|
||||||
// Read the time
|
// Read the time
|
||||||
rtcGetTime((uint8 *)ct);
|
rtcGetTime((uint8 *)ct);
|
||||||
BCDToInteger((uint8 *)&(ct[1]), 7);
|
BCDToInteger((uint8 *)&(ct[1]), 7);
|
||||||
|
|
||||||
// Read the temperature
|
// Read the temperature
|
||||||
temp = touchReadTemperature(&t1, &t2);
|
temp = touchReadTemperature(&t1, &t2);
|
||||||
|
|
||||||
|
|
||||||
// Update the IPC struct
|
// Update the IPC struct
|
||||||
IPC->heartbeat = heartbeat;
|
IPC->heartbeat = heartbeat;
|
||||||
IPC->buttons = but;
|
IPC->buttons = but;
|
||||||
|
@ -491,7 +491,7 @@ void InterruptTimer3() {
|
||||||
IPC->tdiode1 = t1;
|
IPC->tdiode1 = t1;
|
||||||
IPC->tdiode2 = t2;
|
IPC->tdiode2 = t2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//sound code :)
|
//sound code :)
|
||||||
TransferSound *snd = IPC->soundData;
|
TransferSound *snd = IPC->soundData;
|
||||||
|
@ -508,12 +508,12 @@ void InterruptTimer3() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_DEBUGGER
|
#ifdef USE_DEBUGGER
|
||||||
Wifi_Update(); // update wireless in vblank
|
Wifi_Update(); // update wireless in vblank
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -530,10 +530,10 @@ void arm7_fifo() { // check incoming fifo messages
|
||||||
if (msg==0x87654321) Wifi_Sync();
|
if (msg==0x87654321) Wifi_Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void initDebugger() {
|
void initDebugger() {
|
||||||
|
|
||||||
// set up the wifi irq
|
// set up the wifi irq
|
||||||
irqSet(IRQ_WIFI, Wifi_Interrupt); // set up wifi interrupt
|
irqSet(IRQ_WIFI, Wifi_Interrupt); // set up wifi interrupt
|
||||||
irqEnable(IRQ_WIFI);
|
irqEnable(IRQ_WIFI);
|
||||||
|
@ -558,7 +558,7 @@ void initDebugger() {
|
||||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ;
|
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_RECV_IRQ;
|
||||||
|
|
||||||
Wifi_SetSyncHandler(arm7_synctoarm9); // allow wifi lib to notify arm9
|
Wifi_SetSyncHandler(arm7_synctoarm9); // allow wifi lib to notify arm9
|
||||||
// arm7 wifi init complete
|
// arm7 wifi init complete
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -572,11 +572,11 @@ void reboot() {
|
||||||
|
|
||||||
int main(int argc, char ** argv) {
|
int main(int argc, char ** argv) {
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_DEBUGGER
|
#ifdef USE_DEBUGGER
|
||||||
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Reset the clock if needed
|
// Reset the clock if needed
|
||||||
rtcReset();
|
rtcReset();
|
||||||
|
|
||||||
|
@ -587,19 +587,19 @@ int main(int argc, char ** argv) {
|
||||||
IPC->reset = false;
|
IPC->reset = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int r = 0; r < 8; r++) {
|
for (int r = 0; r < 8; r++) {
|
||||||
IPC->adpcm.arm7Buffer[r] = (u8 *) malloc(512);
|
IPC->adpcm.arm7Buffer[r] = (u8 *) malloc(512);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int r = 0; r < 4; r++) {
|
for (int r = 0; r < 4; r++) {
|
||||||
soundFilled[r] = false;
|
soundFilled[r] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set up the interrupt handler
|
// Set up the interrupt handler
|
||||||
|
|
||||||
irqInit();
|
irqInit();
|
||||||
|
|
||||||
irqSet(IRQ_VBLANK, InterruptVBlank);
|
irqSet(IRQ_VBLANK, InterruptVBlank);
|
||||||
|
@ -610,7 +610,7 @@ int main(int argc, char ** argv) {
|
||||||
|
|
||||||
irqSet(IRQ_TIMER3, InterruptTimer3);
|
irqSet(IRQ_TIMER3, InterruptTimer3);
|
||||||
irqEnable(IRQ_TIMER3);
|
irqEnable(IRQ_TIMER3);
|
||||||
|
|
||||||
/* REG_IME = 0;
|
/* REG_IME = 0;
|
||||||
IRQ_HANDLER = &InterruptHandler;
|
IRQ_HANDLER = &InterruptHandler;
|
||||||
REG_IE = IRQ_VBLANK | IRQ_TIMER1 | IRQ_TIMER3;
|
REG_IE = IRQ_VBLANK | IRQ_TIMER1 | IRQ_TIMER3;
|
||||||
|
@ -619,10 +619,10 @@ int main(int argc, char ** argv) {
|
||||||
REG_IME = 1;
|
REG_IME = 1;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_DEBUGGER
|
#ifdef USE_DEBUGGER
|
||||||
initDebugger();
|
initDebugger();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Keep the ARM7 out of main RAM
|
// Keep the ARM7 out of main RAM
|
||||||
while ((1)) {
|
while ((1)) {
|
||||||
|
@ -646,6 +646,6 @@ int main(int argc, char ** argv) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,10 @@ ifdef DS_BUILD_F
|
||||||
# TODO: Fix this. When libmad is compiled in, the Kyrandia resource loading
|
# TODO: Fix this. When libmad is compiled in, the Kyrandia resource loading
|
||||||
# searches through it's entire index to find an mp3 each time a voice sample is requested
|
# searches through it's entire index to find an mp3 each time a voice sample is requested
|
||||||
# this causes a nasty pause.
|
# this causes a nasty pause.
|
||||||
else
|
else
|
||||||
ifdef DS_BUILD_E
|
ifdef DS_BUILD_E
|
||||||
# TODO: Inherit the earth uses so much RAM that I have removed libmad in order to
|
# TODO: Inherit the earth uses so much RAM that I have removed libmad in order to
|
||||||
# claw some back.
|
# claw some back.
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -135,7 +135,7 @@ ifdef DS_BUILD_B
|
||||||
BUILD=scummvm-B
|
BUILD=scummvm-B
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef DS_BUILD_C
|
ifdef DS_BUILD_C
|
||||||
DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_C
|
DEFINES = -DDS_NON_SCUMM_BUILD -DDS_BUILD_C
|
||||||
LOGO = logoc.bmp
|
LOGO = logoc.bmp
|
||||||
DISABLE_HE = 1
|
DISABLE_HE = 1
|
||||||
|
@ -287,7 +287,7 @@ ifdef USE_PROFILER
|
||||||
CFLAGS += -mpoke-function-name -finstrument-functions -g
|
CFLAGS += -mpoke-function-name -finstrument-functions -g
|
||||||
DEFINES += -DUSE_PROFILER
|
DEFINES += -DUSE_PROFILER
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CXXFLAGS= $(CFLAGS) -Wno-non-virtual-dtor -Wno-non-virtual-dtor \
|
CXXFLAGS= $(CFLAGS) -Wno-non-virtual-dtor -Wno-non-virtual-dtor \
|
||||||
-fno-exceptions -fno-rtti -mthumb-interwork
|
-fno-exceptions -fno-rtti -mthumb-interwork
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ INCLUDES= -I./ -I$(portdir)/$(BUILD) -I$(srcdir) -I$(srcdir)/common -I$(portdir)
|
||||||
-I$(srcdir)/backends/fs -I$(srcdir)/backends/fs/ds -I$(portdir)/data -I$(libndsdir)/include -I$(portdir)/../commoninclude\
|
-I$(srcdir)/backends/fs -I$(srcdir)/backends/fs/ds -I$(portdir)/data -I$(libndsdir)/include -I$(portdir)/../commoninclude\
|
||||||
-I$(srcdir)/scumm -I$(libndsdir)/include -I$(libndsdir)/include/nds -I$(srcdir)/engines -I$(portdir)/source/mad\
|
-I$(srcdir)/scumm -I$(libndsdir)/include -I$(libndsdir)/include/nds -I$(srcdir)/engines -I$(portdir)/source/mad\
|
||||||
-I$(portdir)/source/libcartreset -include $(srcdir)/common/scummsys.h
|
-I$(portdir)/source/libcartreset -include $(srcdir)/common/scummsys.h
|
||||||
|
|
||||||
|
|
||||||
LIBS = -lm -L$(libndsdir)/lib -L$(portdir)/lib -lnds9
|
LIBS = -lm -L$(libndsdir)/lib -L$(portdir)/lib -lnds9
|
||||||
ifdef USE_MAD
|
ifdef USE_MAD
|
||||||
|
@ -352,15 +352,15 @@ PORT_OBJS := $(portdir)/source/blitters_arm.o $(portdir)/source/cdaudio.o $(port
|
||||||
$(portdir)/source/osystem_ds.o $(portdir)/source/portdefs.o $(portdir)/source/ramsave.o\
|
$(portdir)/source/osystem_ds.o $(portdir)/source/portdefs.o $(portdir)/source/ramsave.o\
|
||||||
$(portdir)/source/scummconsole.o $(portdir)/source/touchkeyboard.o $(portdir)/source/zipreader.o\
|
$(portdir)/source/scummconsole.o $(portdir)/source/touchkeyboard.o $(portdir)/source/zipreader.o\
|
||||||
$(portdir)/source/dsoptions.o $(portdir)/source/keys.o $(portdir)/source/wordcompletion.o
|
$(portdir)/source/dsoptions.o $(portdir)/source/keys.o $(portdir)/source/wordcompletion.o
|
||||||
|
|
||||||
ifdef USE_PROFILER
|
ifdef USE_PROFILER
|
||||||
PORT_OBJS += $(portdir)/source/profiler/cyg-profile.o
|
PORT_OBJS += $(portdir)/source/profiler/cyg-profile.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
DATA_OBJS := $(portdir)/data/icons.o $(portdir)/data/keyboard.o $(portdir)/data/keyboard_pal.o $(portdir)/data/default_font.o $(portdir)/data/8x8font_tga.o
|
DATA_OBJS := $(portdir)/data/icons.o $(portdir)/data/keyboard.o $(portdir)/data/keyboard_pal.o $(portdir)/data/default_font.o $(portdir)/data/8x8font_tga.o
|
||||||
|
|
||||||
|
|
||||||
COMPRESSOR_OBJS := $(portdir)/source/compressor/lz.o
|
COMPRESSOR_OBJS := $(portdir)/source/compressor/lz.o
|
||||||
|
|
||||||
FAT_OBJS := $(portdir)/source/fat/disc_io.o $(portdir)/source/fat/gba_nds_fat.o\
|
FAT_OBJS := $(portdir)/source/fat/disc_io.o $(portdir)/source/fat/gba_nds_fat.o\
|
||||||
|
@ -379,13 +379,13 @@ FAT_OBJS := $(portdir)/source/fat/disc_io.o $(portdir)/source/fat/gba_nds_fat.o
|
||||||
|
|
||||||
# $(portdir)/source/fat/io_cf_common.o $(portdir)/source/fat/io_m3_common.o\
|
# $(portdir)/source/fat/io_cf_common.o $(portdir)/source/fat/io_m3_common.o\
|
||||||
# $(portdir)/source/fat/io_sd_common.o $(portdir)/source/fat/io_scsd_s.o \
|
# $(portdir)/source/fat/io_sd_common.o $(portdir)/source/fat/io_scsd_s.o \
|
||||||
# $(portdir)/source/fat/io_sc_common.o $(portdir)/source/fat/io_sd_common.o
|
# $(portdir)/source/fat/io_sc_common.o $(portdir)/source/fat/io_sd_common.o
|
||||||
|
|
||||||
LIBCARTRESET_OBJS := $(portdir)/source/libcartreset/cartreset.o
|
LIBCARTRESET_OBJS := $(portdir)/source/libcartreset/cartreset.o
|
||||||
|
|
||||||
# Files in this list will be optimisied for speed, otherwise they will be optimised for space
|
# Files in this list will be optimisied for speed, otherwise they will be optimised for space
|
||||||
OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp fmopl.cpp rate.cpp mixer.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.cpp
|
OPTLIST := actor.cpp ds_main.cpp osystem_ds.cpp blitters.cpp fmopl.cpp rate.cpp mixer.cpp isomap.cpp image.cpp gfx.cpp sprite.cpp actor_path.cpp actor_walk.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 := -O3
|
||||||
|
@ -394,11 +394,11 @@ OPT_SPEED := -O3
|
||||||
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MODULE_DIRS += .
|
MODULE_DIRS += .
|
||||||
|
|
||||||
ndsall:
|
ndsall:
|
||||||
|
@ -448,7 +448,7 @@ endef
|
||||||
# $(*).tmp $(@)
|
# $(*).tmp $(@)
|
||||||
# echo "extern const u8" $(notdir $*)"[] __attribute__ ((aligned (4)));" > $(*).h
|
# echo "extern const u8" $(notdir $*)"[] __attribute__ ((aligned (4)));" > $(*).h
|
||||||
# echo "extern const u32" $(notdir $(*))_size[]";" >> $(*).h
|
# echo "extern const u32" $(notdir $(*))_size[]";" >> $(*).h
|
||||||
#
|
#
|
||||||
# echo $(*).h
|
# echo $(*).h
|
||||||
# rm $(*).tmp
|
# rm $(*).tmp
|
||||||
#endef
|
#endef
|
||||||
|
@ -459,7 +459,7 @@ 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:
|
||||||
|
|
||||||
$(MKDIR) $(*D)/$(DEPDIR)
|
$(MKDIR) $(*D)/$(DEPDIR)
|
||||||
|
@ -485,36 +485,36 @@ else
|
||||||
|
|
||||||
$(MKDIR) $(*D)/$(DEPDIR)
|
$(MKDIR) $(*D)/$(DEPDIR)
|
||||||
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
$(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||||
$(CXX) -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" $(if $(findstring $(notdir $<), $(OPTLIST)), $(OPT_SPEED), $(OPT_SIZE)) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
$(CXX) -MMD -MF "$(*D)/$(DEPDIR)/$(*F).d" $(if $(findstring $(notdir $<), $(OPTLIST)), $(OPT_SPEED), $(OPT_SIZE)) $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.pcx
|
%.o : %.pcx
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.bin
|
%.o : %.bin
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.raw
|
%.o : %.raw
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.pal
|
%.o : %.pal
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@echo $(notdir $<)
|
@echo $(notdir $<)
|
||||||
@$(bin2o)
|
@$(bin2o)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%.o : %.map
|
%.o : %.map
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -543,4 +543,4 @@ endif
|
||||||
#%.o: %.s
|
#%.o: %.s
|
||||||
# $(MKDIR) $(*D)/$(DEPDIR)
|
# $(MKDIR) $(*D)/$(DEPDIR)
|
||||||
# $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
# $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) $(CPPFLAGS) -c $(<) -o $*.o
|
||||||
|
|
||||||
|
|
|
@ -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,19 +29,19 @@
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -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}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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,9 +53,9 @@ 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));
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -42,7 +42,7 @@ namespace DS {
|
||||||
|
|
||||||
DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
|
DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
|
||||||
addButton(this, 10, 175, "Close", GUI::kCloseCmd, 'C');
|
addButton(this, 10, 175, "Close", GUI::kCloseCmd, 'C');
|
||||||
|
|
||||||
#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');
|
||||||
|
@ -152,7 +152,7 @@ DSOptionsDialog::DSOptionsDialog() : GUI::Dialog(20, 0, 320 - 40, 230 - 20) {
|
||||||
} else {
|
} else {
|
||||||
_touchY->setValue(0);
|
_touchY->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DSOptionsDialog::~DSOptionsDialog() {
|
DSOptionsDialog::~DSOptionsDialog() {
|
||||||
|
@ -186,7 +186,7 @@ void DSOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint
|
||||||
/* 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 +195,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 +205,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 +220,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,13 +235,13 @@ void showOptionsDialog() {
|
||||||
togglePause();
|
togglePause();
|
||||||
|
|
||||||
DS::displayMode16Bit();
|
DS::displayMode16Bit();
|
||||||
|
|
||||||
|
|
||||||
DSOptionsDialog* d = new DSOptionsDialog();
|
DSOptionsDialog* d = new DSOptionsDialog();
|
||||||
d->runModal();
|
d->runModal();
|
||||||
consolePrintf("deleting dialog\n");
|
consolePrintf("deleting dialog\n");
|
||||||
delete d;
|
delete d;
|
||||||
|
|
||||||
consolePrintf("going to 8 bit\n");
|
consolePrintf("going to 8 bit\n");
|
||||||
DS::displayMode8Bit();
|
DS::displayMode8Bit();
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ 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();
|
||||||
|
@ -56,7 +56,7 @@ protected:
|
||||||
GUI::CheckboxWidget* _cpuScaler;
|
GUI::CheckboxWidget* _cpuScaler;
|
||||||
GUI::CheckboxWidget* _showCursorCheckbox;
|
GUI::CheckboxWidget* _showCursorCheckbox;
|
||||||
GUI::CheckboxWidget* _snapToBorderCheckbox;
|
GUI::CheckboxWidget* _snapToBorderCheckbox;
|
||||||
|
|
||||||
#ifdef DS_SCUMM_BUILD
|
#ifdef DS_SCUMM_BUILD
|
||||||
Scumm::SaveLoadChooser* _delDialog;
|
Scumm::SaveLoadChooser* _delDialog;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -502,15 +502,15 @@ bool disc_WriteSectors(u32 sector, u8 numSecs, void* buffer)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
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 +518,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)
|
||||||
{
|
{
|
||||||
|
|
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