mirror of https://github.com/stella-emu/stella.git
Massive update of the wince port. Works almost correctly on smartphones, pocket pcs need some testing.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@842 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
330c27224c
commit
00b702cdc0
|
@ -1,331 +1,331 @@
|
|||
#include <sstream>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
//#include <direct.h>
|
||||
|
||||
#include "FSNode.hxx"
|
||||
|
||||
/*
|
||||
* Implementation of the Stella file system API based on Windows API.
|
||||
*/
|
||||
|
||||
class WindowsFilesystemNode : public AbstractFilesystemNode
|
||||
{
|
||||
public:
|
||||
WindowsFilesystemNode();
|
||||
WindowsFilesystemNode(const string &path);
|
||||
WindowsFilesystemNode(const WindowsFilesystemNode* node);
|
||||
|
||||
virtual string displayName() const { return _displayName; }
|
||||
virtual bool isValid() const { return _isValid; }
|
||||
virtual bool isDirectory() const { return _isDirectory; }
|
||||
virtual string path() const { return _path; }
|
||||
|
||||
virtual FSList listDir(ListMode) const;
|
||||
virtual AbstractFilesystemNode* parent() const;
|
||||
|
||||
protected:
|
||||
string _displayName;
|
||||
bool _isDirectory;
|
||||
bool _isValid;
|
||||
bool _isPseudoRoot;
|
||||
string _path;
|
||||
|
||||
private:
|
||||
static char* toAscii(TCHAR* x);
|
||||
static TCHAR* toUnicode(char* x);
|
||||
static void addFile (FSList& list, ListMode mode,
|
||||
const char* base, WIN32_FIND_DATA* find_data);
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
static const char* lastPathComponent(const string& str)
|
||||
{
|
||||
const char* start = str.c_str();
|
||||
const char* cur = start + str.size() - 2;
|
||||
|
||||
while (cur > start && *cur != '\\')
|
||||
--cur;
|
||||
|
||||
return cur + 1;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
static string validatePath(const string& p)
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
//#include <direct.h>
|
||||
|
||||
#include "FSNode.hxx"
|
||||
|
||||
/*
|
||||
* Implementation of the Stella file system API based on Windows API.
|
||||
*/
|
||||
|
||||
class WindowsFilesystemNode : public AbstractFilesystemNode
|
||||
{
|
||||
|
||||
public:
|
||||
WindowsFilesystemNode();
|
||||
WindowsFilesystemNode(const string &path);
|
||||
WindowsFilesystemNode(const WindowsFilesystemNode* node);
|
||||
|
||||
virtual string displayName() const { return _displayName; }
|
||||
virtual bool isValid() const { return _isValid; }
|
||||
virtual bool isDirectory() const { return _isDirectory; }
|
||||
virtual string path() const { return _path; }
|
||||
|
||||
virtual FSList listDir(ListMode) const;
|
||||
virtual AbstractFilesystemNode* parent() const;
|
||||
|
||||
protected:
|
||||
string _displayName;
|
||||
bool _isDirectory;
|
||||
bool _isValid;
|
||||
bool _isPseudoRoot;
|
||||
string _path;
|
||||
|
||||
private:
|
||||
static char* toAscii(TCHAR* x);
|
||||
static TCHAR* toUnicode(char* x);
|
||||
static void addFile (FSList& list, ListMode mode,
|
||||
const char* base, WIN32_FIND_DATA* find_data);
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
static const char* lastPathComponent(const string& str)
|
||||
{
|
||||
const char* start = str.c_str();
|
||||
const char* cur = start + str.size() - 2;
|
||||
|
||||
while (cur > start && *cur != '\\')
|
||||
--cur;
|
||||
|
||||
return cur + 1;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
static string validatePath(const string& p)
|
||||
|
||||
{
|
||||
|
||||
string path = p;
|
||||
|
||||
|
||||
/* if(p.size() < 2 || p[1] != ':')
|
||||
|
||||
|
||||
path = "c:";
|
||||
*/
|
||||
*/
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
char* WindowsFilesystemNode::toAscii(TCHAR* x)
|
||||
{
|
||||
#ifndef UNICODE
|
||||
return (char*)x;
|
||||
#else
|
||||
static char asciiString[MAX_PATH];
|
||||
WideCharToMultiByte(CP_ACP, 0, x, _tcslen(x) + 1, asciiString, sizeof(asciiString), NULL, NULL);
|
||||
return asciiString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
TCHAR* WindowsFilesystemNode::toUnicode(char* x)
|
||||
{
|
||||
#ifndef UNICODE
|
||||
return (TCHAR*)x;
|
||||
#else
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, x, strlen(x) + 1, unicodeString, sizeof(unicodeString));
|
||||
return unicodeString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void WindowsFilesystemNode::addFile(FSList& list, ListMode mode,
|
||||
const char* base, WIN32_FIND_DATA* find_data)
|
||||
{
|
||||
WindowsFilesystemNode entry;
|
||||
char* asciiName = toAscii(find_data->cFileName);
|
||||
bool isDirectory;
|
||||
|
||||
// Skip local directory (.) and parent (..)
|
||||
if (!strcmp(asciiName, ".") || !strcmp(asciiName, ".."))
|
||||
return;
|
||||
|
||||
isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false);
|
||||
|
||||
if ((!isDirectory && mode == kListDirectoriesOnly) ||
|
||||
(isDirectory && mode == kListFilesOnly))
|
||||
return;
|
||||
|
||||
entry._isDirectory = isDirectory;
|
||||
entry._displayName = asciiName;
|
||||
entry._path = base;
|
||||
entry._path += asciiName;
|
||||
if (entry._isDirectory)
|
||||
entry._path += "\\";
|
||||
entry._isValid = true;
|
||||
entry._isPseudoRoot = false;
|
||||
|
||||
list.push_back(wrap(new WindowsFilesystemNode(&entry)));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* FilesystemNode::getRoot()
|
||||
{
|
||||
return new WindowsFilesystemNode();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* FilesystemNode::getNodeForPath(const string& path)
|
||||
{
|
||||
return new WindowsFilesystemNode(path);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode()
|
||||
{
|
||||
_isDirectory = true;
|
||||
|
||||
// Create a virtual root directory for standard Windows system
|
||||
_isValid = false;
|
||||
_path = "";
|
||||
_isPseudoRoot = true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode(const string& path)
|
||||
{
|
||||
_path = validatePath(path);
|
||||
_displayName = lastPathComponent(_path);
|
||||
_isValid = true;
|
||||
_isDirectory = true;
|
||||
_isPseudoRoot = false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode(const WindowsFilesystemNode* node)
|
||||
{
|
||||
_displayName = node->_displayName;
|
||||
_isDirectory = node->_isDirectory;
|
||||
_isValid = node->_isValid;
|
||||
_isPseudoRoot = node->_isPseudoRoot;
|
||||
_path = node->_path;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FSList WindowsFilesystemNode::listDir(ListMode mode) const
|
||||
{
|
||||
assert(_isDirectory);
|
||||
|
||||
FSList myList;
|
||||
|
||||
if (_isPseudoRoot)
|
||||
{
|
||||
addFile(myList, mode, "\\", NULL);
|
||||
// Drives enumeration
|
||||
/* TCHAR drive_buffer[100];
|
||||
GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer);
|
||||
|
||||
for (TCHAR *current_drive = drive_buffer; *current_drive;
|
||||
current_drive += _tcslen(current_drive) + 1)
|
||||
{
|
||||
WindowsFilesystemNode entry;
|
||||
char drive_name[2];
|
||||
|
||||
drive_name[0] = toAscii(current_drive)[0];
|
||||
drive_name[1] = '\0';
|
||||
entry._displayName = drive_name;
|
||||
entry._isDirectory = true;
|
||||
entry._isValid = true;
|
||||
entry._isPseudoRoot = false;
|
||||
entry._path = toAscii(current_drive);
|
||||
myList.push_back(wrap(new WindowsFilesystemNode(&entry)));
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// Files enumeration
|
||||
WIN32_FIND_DATA desc;
|
||||
HANDLE handle;
|
||||
char searchPath[MAX_PATH + 10];
|
||||
|
||||
sprintf(searchPath, "%s*", _path.c_str());
|
||||
|
||||
handle = FindFirstFile(toUnicode(searchPath), &desc);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return myList;
|
||||
|
||||
addFile(myList, mode, _path.c_str(), &desc);
|
||||
while (FindNextFile(handle, &desc))
|
||||
addFile(myList, mode, _path.c_str(), &desc);
|
||||
|
||||
FindClose(handle);
|
||||
}
|
||||
|
||||
return myList;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* WindowsFilesystemNode::parent() const
|
||||
{
|
||||
assert(_isValid || _isPseudoRoot);
|
||||
if (_isPseudoRoot)
|
||||
return 0;
|
||||
|
||||
WindowsFilesystemNode* p = new WindowsFilesystemNode();
|
||||
if (_path.size() > 3)
|
||||
{
|
||||
const char *start = _path.c_str();
|
||||
const char *end = lastPathComponent(_path);
|
||||
|
||||
p = new WindowsFilesystemNode();
|
||||
p->_path = string(start, end - start);
|
||||
p->_isValid = true;
|
||||
p->_isDirectory = true;
|
||||
p->_displayName = lastPathComponent(p->_path);
|
||||
p->_isPseudoRoot = false;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
char* WindowsFilesystemNode::toAscii(TCHAR* x)
|
||||
{
|
||||
#ifndef UNICODE
|
||||
return (char*)x;
|
||||
#else
|
||||
static char asciiString[MAX_PATH];
|
||||
WideCharToMultiByte(CP_ACP, 0, x, _tcslen(x) + 1, asciiString, sizeof(asciiString), NULL, NULL);
|
||||
return asciiString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
TCHAR* WindowsFilesystemNode::toUnicode(char* x)
|
||||
{
|
||||
#ifndef UNICODE
|
||||
return (TCHAR*)x;
|
||||
#else
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, x, strlen(x) + 1, unicodeString, sizeof(unicodeString));
|
||||
return unicodeString;
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void WindowsFilesystemNode::addFile(FSList& list, ListMode mode,
|
||||
const char* base, WIN32_FIND_DATA* find_data)
|
||||
{
|
||||
WindowsFilesystemNode entry;
|
||||
char* asciiName = toAscii(find_data->cFileName);
|
||||
bool isDirectory;
|
||||
|
||||
// Skip local directory (.) and parent (..)
|
||||
if (!strcmp(asciiName, ".") || !strcmp(asciiName, ".."))
|
||||
return;
|
||||
|
||||
isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false);
|
||||
|
||||
if ((!isDirectory && mode == kListDirectoriesOnly) ||
|
||||
(isDirectory && mode == kListFilesOnly))
|
||||
return;
|
||||
|
||||
entry._isDirectory = isDirectory;
|
||||
entry._displayName = asciiName;
|
||||
entry._path = base;
|
||||
entry._path += asciiName;
|
||||
if (entry._isDirectory)
|
||||
entry._path += "\\";
|
||||
entry._isValid = true;
|
||||
entry._isPseudoRoot = false;
|
||||
|
||||
list.push_back(wrap(new WindowsFilesystemNode(&entry)));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* FilesystemNode::getRoot()
|
||||
{
|
||||
return new WindowsFilesystemNode();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* FilesystemNode::getNodeForPath(const string& path)
|
||||
{
|
||||
return new WindowsFilesystemNode(path);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode()
|
||||
{
|
||||
_isDirectory = true;
|
||||
|
||||
// Create a virtual root directory for standard Windows system
|
||||
_isValid = false;
|
||||
_path = "";
|
||||
_isPseudoRoot = true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode(const string& path)
|
||||
{
|
||||
_path = validatePath(path);
|
||||
_displayName = lastPathComponent(_path);
|
||||
_isValid = true;
|
||||
_isDirectory = true;
|
||||
_isPseudoRoot = false;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
WindowsFilesystemNode::WindowsFilesystemNode(const WindowsFilesystemNode* node)
|
||||
{
|
||||
_displayName = node->_displayName;
|
||||
_isDirectory = node->_isDirectory;
|
||||
_isValid = node->_isValid;
|
||||
_isPseudoRoot = node->_isPseudoRoot;
|
||||
_path = node->_path;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FSList WindowsFilesystemNode::listDir(ListMode mode) const
|
||||
{
|
||||
assert(_isDirectory);
|
||||
|
||||
FSList myList;
|
||||
|
||||
if (_isPseudoRoot)
|
||||
{
|
||||
addFile(myList, mode, "\\", NULL);
|
||||
// Drives enumeration
|
||||
/* TCHAR drive_buffer[100];
|
||||
GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer);
|
||||
|
||||
for (TCHAR *current_drive = drive_buffer; *current_drive;
|
||||
current_drive += _tcslen(current_drive) + 1)
|
||||
{
|
||||
WindowsFilesystemNode entry;
|
||||
char drive_name[2];
|
||||
|
||||
drive_name[0] = toAscii(current_drive)[0];
|
||||
drive_name[1] = '\0';
|
||||
entry._displayName = drive_name;
|
||||
entry._isDirectory = true;
|
||||
entry._isValid = true;
|
||||
entry._isPseudoRoot = false;
|
||||
entry._path = toAscii(current_drive);
|
||||
myList.push_back(wrap(new WindowsFilesystemNode(&entry)));
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
// Files enumeration
|
||||
WIN32_FIND_DATA desc;
|
||||
HANDLE handle;
|
||||
char searchPath[MAX_PATH + 10];
|
||||
|
||||
sprintf(searchPath, "%s*", _path.c_str());
|
||||
|
||||
handle = FindFirstFile(toUnicode(searchPath), &desc);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return myList;
|
||||
|
||||
addFile(myList, mode, _path.c_str(), &desc);
|
||||
while (FindNextFile(handle, &desc))
|
||||
addFile(myList, mode, _path.c_str(), &desc);
|
||||
|
||||
FindClose(handle);
|
||||
}
|
||||
|
||||
return myList;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AbstractFilesystemNode* WindowsFilesystemNode::parent() const
|
||||
{
|
||||
assert(_isValid || _isPseudoRoot);
|
||||
if (_isPseudoRoot)
|
||||
return 0;
|
||||
|
||||
WindowsFilesystemNode* p = new WindowsFilesystemNode();
|
||||
if (_path.size() > 3)
|
||||
{
|
||||
const char *start = _path.c_str();
|
||||
const char *end = lastPathComponent(_path);
|
||||
|
||||
p = new WindowsFilesystemNode();
|
||||
p->_path = string(start, end - start);
|
||||
p->_isValid = true;
|
||||
p->_isDirectory = true;
|
||||
p->_displayName = lastPathComponent(p->_path);
|
||||
p->_isPseudoRoot = false;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool AbstractFilesystemNode::fileExists(const string& path)
|
||||
|
||||
|
||||
{
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, path.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
|
||||
BOOL b = GetFileAttributesEx(unicodeString, GetFileExInfoStandard, &attr);
|
||||
|
||||
|
||||
|
||||
return ((b != 0) && !(attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool AbstractFilesystemNode::dirExists(const string& path)
|
||||
|
||||
{
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
string tmp(path);
|
||||
if (tmp.at(path.size()-1) == '\\')
|
||||
tmp.resize(path.size()-1);
|
||||
MultiByteToWideChar(CP_ACP, 0, tmp.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
BOOL b = GetFileAttributesEx(unicodeString, GetFileExInfoStandard, &attr);
|
||||
|
||||
|
||||
|
||||
return ((b != 0) && (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool AbstractFilesystemNode::makeDir(const string& path)
|
||||
|
||||
{
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
string tmp(path);
|
||||
if (tmp.at(path.size()-1) == '\\')
|
||||
tmp.resize(path.size()-1);
|
||||
MultiByteToWideChar(CP_ACP, 0, tmp.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
return CreateDirectory(unicodeString, NULL) != 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
string AbstractFilesystemNode::modTime(const string& path)
|
||||
|
||||
{
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, path.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, path.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
|
||||
BOOL b = GetFileAttributesEx(unicodeString, GetFileExInfoStandard, &attr);
|
||||
|
||||
if(b == 0)
|
||||
|
||||
return "";
|
||||
|
||||
ostringstream buf;
|
||||
|
||||
buf << attr.ftLastWriteTime.dwHighDateTime << attr.ftLastWriteTime.dwLowDateTime;
|
||||
|
||||
return buf.str();
|
||||
|
||||
|
||||
|
||||
return ((b != 0) && !(attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool AbstractFilesystemNode::dirExists(const string& path)
|
||||
|
||||
{
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
string tmp(path);
|
||||
if (tmp.at(path.size()-1) == '\\')
|
||||
tmp.resize(path.size()-1);
|
||||
MultiByteToWideChar(CP_ACP, 0, tmp.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
BOOL b = GetFileAttributesEx(unicodeString, GetFileExInfoStandard, &attr);
|
||||
|
||||
|
||||
|
||||
return ((b != 0) && (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool AbstractFilesystemNode::makeDir(const string& path)
|
||||
|
||||
{
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
string tmp(path);
|
||||
if (tmp.at(path.size()-1) == '\\')
|
||||
tmp.resize(path.size()-1);
|
||||
MultiByteToWideChar(CP_ACP, 0, tmp.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
return CreateDirectory(unicodeString, NULL) != 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
string AbstractFilesystemNode::modTime(const string& path)
|
||||
|
||||
{
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA attr;
|
||||
|
||||
static TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, path.c_str(), strlen(path.c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
|
||||
BOOL b = GetFileAttributesEx(unicodeString, GetFileExInfoStandard, &attr);
|
||||
|
||||
if(b == 0)
|
||||
|
||||
return "";
|
||||
|
||||
ostringstream buf;
|
||||
|
||||
buf << attr.ftLastWriteTime.dwHighDateTime << attr.ftLastWriteTime.dwLowDateTime;
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,253 +1,504 @@
|
|||
#include <windows.h>
|
||||
#include <gx.h>
|
||||
#include "FrameBufferWinCE.hxx"
|
||||
#include "Console.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Font.hxx"
|
||||
|
||||
FrameBufferWinCE::FrameBufferWinCE(OSystem *osystem)
|
||||
: FrameBuffer(osystem), myDstScreen(NULL), SubsystemInited(false), displacement(0)
|
||||
{
|
||||
}
|
||||
|
||||
FrameBufferWinCE::~FrameBufferWinCE()
|
||||
{
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setPalette(const uInt32* palette)
|
||||
{
|
||||
//setup palette
|
||||
GXDisplayProperties gxdp = GXGetDisplayProperties();
|
||||
for (uInt16 i=0; i<256; i++)
|
||||
{
|
||||
uInt8 r = (uInt8) ((palette[i] & 0xFF0000) >> 16);
|
||||
uInt8 g = (uInt8) ((palette[i] & 0x00FF00) >> 8);
|
||||
uInt8 b = (uInt8) (palette[i] & 0x0000FF);
|
||||
if(gxdp.ffFormat & kfDirect565)
|
||||
pal[i] = (uInt16) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3) );
|
||||
else if(gxdp.ffFormat & kfDirect555)
|
||||
pal[i] = (uInt16) ( ((r & 0xF8) << 7) | ((g & 0xF8) << 3) | ((b & 0xF8) >> 3) );
|
||||
else
|
||||
return;
|
||||
}
|
||||
SubsystemInited = false;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::initSubsystem()
|
||||
{
|
||||
GXDisplayProperties gxdp = GXGetDisplayProperties();
|
||||
for (int i=0; i<kNumColors - 256; i++)
|
||||
{
|
||||
uInt8 r = (ourGUIColors[i][0] & 0xFF);
|
||||
uInt8 g = (ourGUIColors[i][1] & 0xFF);
|
||||
uInt8 b = (ourGUIColors[i][2] & 0xFF);
|
||||
if(gxdp.ffFormat & kfDirect565)
|
||||
guipal[i] = (uInt16) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3) );
|
||||
else if(gxdp.ffFormat & kfDirect555)
|
||||
guipal[i] = (uInt16) ( ((r & 0xF8) << 7) | ((g & 0xF8) << 3) | ((b & 0xF8) >> 3) );
|
||||
else
|
||||
return false;
|
||||
}
|
||||
// screen extents
|
||||
//GXDisplayProperties gxdp = GXGetDisplayProperties();
|
||||
pixelstep = gxdp.cbxPitch;
|
||||
linestep = gxdp.cbyPitch;
|
||||
scrwidth = gxdp.cxWidth;
|
||||
scrheight = gxdp.cyHeight;
|
||||
|
||||
SubsystemInited = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::lateinit(void)
|
||||
{
|
||||
myWidth = myOSystem->console().mediaSource().width();
|
||||
myHeight = myOSystem->console().mediaSource().height();
|
||||
if (scrwidth > myWidth)
|
||||
displacement = (scrwidth - myWidth) / 2 * pixelstep;
|
||||
else
|
||||
displacement = 0;
|
||||
if (scrheight > myHeight)
|
||||
displacement += (scrheight - myHeight) / 2 * linestep;
|
||||
|
||||
SubsystemInited = true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::preFrameUpdate()
|
||||
{
|
||||
myDstScreen = (uInt8 *) GXBeginDraw();
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawMediaSource()
|
||||
{
|
||||
uInt8 *sc, *sp;
|
||||
uInt8 *d, *pl;
|
||||
|
||||
if (!SubsystemInited)
|
||||
{
|
||||
lateinit();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (d = myDstScreen) == NULL )
|
||||
return;
|
||||
|
||||
d += displacement;
|
||||
pl = d;
|
||||
sc = myOSystem->console().mediaSource().currentFrameBuffer();
|
||||
sp = myOSystem->console().mediaSource().previousFrameBuffer();
|
||||
for (uInt16 y=0; y<myHeight; y++)
|
||||
{
|
||||
for (uInt16 x=0; x<(myWidth>>2); x++)
|
||||
{
|
||||
if ( *((uInt32 *) sc) != *((uInt32 *) sp) )
|
||||
{
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc += 4;
|
||||
d += (pixelstep << 2);
|
||||
}
|
||||
sp += 4;
|
||||
}
|
||||
d = pl + linestep;
|
||||
pl = d;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::postFrameUpdate()
|
||||
{
|
||||
GXEndDraw();
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, OverlayColor color)
|
||||
{
|
||||
GUI::Font* myfont = (GUI::Font*)font;
|
||||
const FontDesc& desc = myfont->desc();
|
||||
|
||||
if (!myDstScreen) return;
|
||||
//if (!SubsystemInited) {lateinit(false); return;}
|
||||
|
||||
if(c < desc.firstchar || c >= desc.firstchar + desc.size)
|
||||
{
|
||||
if (c == ' ')
|
||||
return;
|
||||
c = desc.defaultchar;
|
||||
}
|
||||
|
||||
const Int32 w = myfont->getCharWidth(c);
|
||||
const Int32 h = myfont->getFontHeight();
|
||||
c -= desc.firstchar;
|
||||
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[c] : (c * h));
|
||||
|
||||
uInt8 *d = myDstScreen + (y/* >> 1*/) * linestep + (x >> 1) * pixelstep;
|
||||
uInt32 stride = (scrwidth - w) * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
|
||||
for(int y2 = 0; y2 < h; y2++)
|
||||
{
|
||||
const uInt16 buffer = *tmp++;
|
||||
uInt16 mask = 0x8000;
|
||||
|
||||
for(int x2 = 0; x2 < w; x2++, mask >>= 1)
|
||||
{
|
||||
if ((buffer & mask) != 0)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
}
|
||||
d += pixelstep;
|
||||
}
|
||||
d += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::scanline(uInt32 row, uInt8* data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setAspectRatio()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::createScreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::toggleFilter()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uInt32 FrameBufferWinCE::mapRGB(Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
//if (!SubsystemInited) {lateinit(false); return;}
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int kx2 = x2>> 1;
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
for (;kx < kx2; kx++)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
d += pixelstep;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
//if (!SubsystemInited) {lateinit(false); return;}
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int ky2 = y2>> 1;
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
for (;ky < ky2; ky++)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
d += linestep;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
//if (!SubsystemInited) {lateinit(false); return;}
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int kw = (w >> 1) - 1; int kh = h /*>> 1*/;
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
uInt32 stride = (scrwidth - kw - 1) * pixelstep;
|
||||
for (int h2 = kh; h2 >= 0; h2--)
|
||||
{
|
||||
for (int w2 = kw; w2>=0; w2--)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
d += pixelstep;
|
||||
}
|
||||
d += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawBitmap(uInt32* bitmap, Int32 x, Int32 y, OverlayColor color, Int32 h)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::translateCoords(Int32* x, Int32* y)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#include <windows.h>
|
||||
#include "FrameBufferWinCE.hxx"
|
||||
#include "Console.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "Font.hxx"
|
||||
|
||||
#define OPTPIXAVERAGE(pix1,pix2) ( ((((pix1 & optgreenmaskN) + (pix2 & optgreenmaskN)) >> 1) & optgreenmaskN) | ((((pix1 & optgreenmask) + (pix2 & optgreenmask)) >> 1) & optgreenmask) )
|
||||
|
||||
FrameBufferWinCE::FrameBufferWinCE(OSystem *osystem)
|
||||
: FrameBuffer(osystem), myDstScreen(NULL), SubsystemInited(false), displacement(0),
|
||||
issmartphone(true), islandscape(false), displaymode(0)
|
||||
{
|
||||
}
|
||||
|
||||
FrameBufferWinCE::~FrameBufferWinCE()
|
||||
{
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setPalette(const uInt32* palette)
|
||||
{
|
||||
//setup palette
|
||||
gxdp = GXGetDisplayProperties();
|
||||
for (uInt16 i=0; i<256; i++)
|
||||
{
|
||||
uInt8 r = (uInt8) ((palette[i] & 0xFF0000) >> 16);
|
||||
uInt8 g = (uInt8) ((palette[i] & 0x00FF00) >> 8);
|
||||
uInt8 b = (uInt8) (palette[i] & 0x0000FF);
|
||||
if(gxdp.ffFormat & kfDirect565)
|
||||
pal[i] = (uInt16) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3) );
|
||||
else if(gxdp.ffFormat & kfDirect555)
|
||||
pal[i] = (uInt16) ( ((r & 0xF8) << 7) | ((g & 0xF8) << 3) | ((b & 0xF8) >> 3) );
|
||||
else
|
||||
return;
|
||||
}
|
||||
SubsystemInited = false;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::initSubsystem()
|
||||
{
|
||||
gxdp = GXGetDisplayProperties();
|
||||
for (int i=0; i<kNumColors - 256; i++)
|
||||
{
|
||||
uInt8 r = (ourGUIColors[i][0] & 0xFF);
|
||||
uInt8 g = (ourGUIColors[i][1] & 0xFF);
|
||||
uInt8 b = (ourGUIColors[i][2] & 0xFF);
|
||||
if(gxdp.ffFormat & kfDirect565)
|
||||
guipal[i] = (uInt16) ( ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3) );
|
||||
else if(gxdp.ffFormat & kfDirect555)
|
||||
guipal[i] = (uInt16) ( ((r & 0xF8) << 7) | ((g & 0xF8) << 3) | ((b & 0xF8) >> 3) );
|
||||
else
|
||||
return false;
|
||||
}
|
||||
// screen extents
|
||||
if(gxdp.ffFormat & kfDirect565)
|
||||
{
|
||||
optgreenmask = 0x7E0;
|
||||
optgreenmaskN = 0xF81F;
|
||||
}
|
||||
else
|
||||
{
|
||||
optgreenmask = 0x3E0;
|
||||
optgreenmaskN = 0x7C1F;
|
||||
}
|
||||
|
||||
scrwidth = gxdp.cxWidth;
|
||||
scrheight = gxdp.cyHeight;
|
||||
if (scrwidth == 176 && scrheight == 220)
|
||||
issmartphone = true;
|
||||
else
|
||||
issmartphone = false;
|
||||
islandscape = false;
|
||||
setmode(0);
|
||||
|
||||
SubsystemInited = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setmode(uInt8 mode)
|
||||
{
|
||||
displaymode = mode % 3;
|
||||
switch (displaymode)
|
||||
{
|
||||
// portrait
|
||||
case 0:
|
||||
pixelstep = gxdp.cbxPitch;
|
||||
linestep = gxdp.cbyPitch;
|
||||
islandscape = false;
|
||||
break;
|
||||
|
||||
// landscape
|
||||
case 1:
|
||||
pixelstep = - gxdp.cbyPitch;
|
||||
linestep = gxdp.cbxPitch;
|
||||
islandscape = true;
|
||||
break;
|
||||
|
||||
// inverted landscape
|
||||
case 2:
|
||||
pixelstep = gxdp.cbyPitch;
|
||||
linestep = - gxdp.cbxPitch;
|
||||
islandscape = true;
|
||||
break;
|
||||
}
|
||||
|
||||
pixelsteptimes5 = pixelstep * 5;
|
||||
pixelsteptimes6 = pixelstep * 6;
|
||||
SubsystemInited = false;
|
||||
}
|
||||
|
||||
int FrameBufferWinCE::rotatedisplay(void)
|
||||
{
|
||||
displaymode = (displaymode + 1) % 3;
|
||||
setmode(displaymode);
|
||||
wipescreen();
|
||||
return displaymode;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::lateinit(void)
|
||||
{
|
||||
int w;
|
||||
myWidth = myOSystem->console().mediaSource().width();
|
||||
myHeight = myOSystem->console().mediaSource().height();
|
||||
|
||||
if (issmartphone)
|
||||
if (!islandscape)
|
||||
w = myWidth;
|
||||
else
|
||||
w = (int) ((float) myWidth * 11.0 / 8.0 + 0.5);
|
||||
else
|
||||
if (!islandscape)
|
||||
w = (int) ((float) myWidth * 3.0 / 2.0 + 0.5);
|
||||
else
|
||||
w = myWidth * 2;
|
||||
|
||||
switch (displaymode)
|
||||
{
|
||||
case 0:
|
||||
if (scrwidth > w)
|
||||
displacement = (scrwidth - w) / 2 * gxdp.cbxPitch;
|
||||
else
|
||||
displacement = 0;
|
||||
if (scrheight > myHeight)
|
||||
{
|
||||
displacement += (scrheight - myHeight) / 2 * gxdp.cbyPitch;
|
||||
minydim = myHeight;
|
||||
}
|
||||
else
|
||||
minydim = scrheight;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
displacement = gxdp.cbyPitch*(gxdp.cyHeight-1);
|
||||
if (scrwidth > myHeight)
|
||||
{
|
||||
minydim = myHeight;
|
||||
displacement += (scrwidth - myHeight) / 2 * gxdp.cbxPitch;
|
||||
}
|
||||
else
|
||||
minydim = scrwidth;
|
||||
if (scrheight > w)
|
||||
displacement -= (scrheight - w) / 2 * gxdp.cbyPitch;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
displacement = gxdp.cbxPitch*(gxdp.cxWidth-1);
|
||||
if (scrwidth > myHeight)
|
||||
{
|
||||
minydim = myHeight;
|
||||
displacement -= (scrwidth - myHeight) / 2 * gxdp.cbxPitch;
|
||||
}
|
||||
else
|
||||
minydim = scrwidth;
|
||||
if (scrheight > w)
|
||||
displacement += (scrheight - w) / 2 * gxdp.cbyPitch;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
SubsystemInited = true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::preFrameUpdate()
|
||||
{
|
||||
myDstScreen = (uInt8 *) GXBeginDraw();
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawMediaSource()
|
||||
{
|
||||
// TODO: define these static, also x & y
|
||||
uInt8 *sc, *sp;
|
||||
uInt8 *d, *pl;
|
||||
uInt16 pix1, pix2;
|
||||
|
||||
if (!SubsystemInited)
|
||||
lateinit();
|
||||
|
||||
if ( (d = myDstScreen) == NULL )
|
||||
return;
|
||||
|
||||
d += displacement;
|
||||
pl = d;
|
||||
sc = myOSystem->console().mediaSource().currentFrameBuffer();
|
||||
sp = myOSystem->console().mediaSource().previousFrameBuffer();
|
||||
|
||||
if (issmartphone && islandscape == 0)
|
||||
{
|
||||
// straight
|
||||
for (uInt16 y=0; y<myHeight; y++)
|
||||
{
|
||||
for (uInt16 x=0; x<(myWidth>>2); x++)
|
||||
{
|
||||
if ( *((uInt32 *) sc) != *((uInt32 *) sp) )
|
||||
{
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc += 4;
|
||||
d += (pixelstep << 2);
|
||||
}
|
||||
sp += 4;
|
||||
}
|
||||
d = pl + linestep;
|
||||
pl = d;
|
||||
}
|
||||
}
|
||||
else if (issmartphone && islandscape)
|
||||
{
|
||||
for (uInt16 y=0; y<minydim; y++)
|
||||
{
|
||||
for (uInt16 x=0; x<(myWidth>>2); x++)
|
||||
{
|
||||
// 11/8
|
||||
// **X**
|
||||
if ( *((uInt32 *) sc) != *((uInt32 *) sp) )
|
||||
{
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
pix1 = pal[*sc++]; pix2 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix1; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
*((uInt16 *)d) = pix2; d += pixelstep;
|
||||
*((uInt16 *)d) = pal[*sc++]; d += pixelstep;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc += 4;
|
||||
d += pixelsteptimes5;
|
||||
}
|
||||
sp += 4;
|
||||
if (++x>=(myWidth>>2)) break;
|
||||
|
||||
// *X**X*
|
||||
if ( *((uInt32 *) sc) != *((uInt32 *) sp) )
|
||||
{
|
||||
pix1 = pal[*sc++]; pix2 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix1; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
*((uInt16 *)d) = pix2; d += pixelstep;
|
||||
pix1 = pal[*sc++]; pix2 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix1; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
*((uInt16 *)d) = pix2; d += pixelstep;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc += 4;
|
||||
d += pixelsteptimes6;
|
||||
}
|
||||
sp += 4;
|
||||
}
|
||||
d = pl + linestep;
|
||||
pl = d;
|
||||
}
|
||||
}
|
||||
else if (issmartphone == 0 && islandscape == 0)
|
||||
{
|
||||
// 3/2
|
||||
for (uInt16 y=0; y<myHeight; y++)
|
||||
{
|
||||
for (uInt16 x=0; x<(myWidth>>2); x++)
|
||||
{
|
||||
if ( *((uInt32 *) sc) != *((uInt32 *) sp) )
|
||||
{
|
||||
pix1 = pal[*sc++]; pix2 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix1; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
*((uInt16 *)d) = pix2; d += pixelstep;
|
||||
pix1 = pal[*sc++]; pix2 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix1; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
*((uInt16 *)d) = pix2; d += pixelstep;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc += 4;
|
||||
d += pixelsteptimes6;
|
||||
}
|
||||
sp += 4;
|
||||
}
|
||||
d = pl + linestep;
|
||||
pl = d;
|
||||
}
|
||||
}
|
||||
else if (issmartphone == 0 && islandscape)
|
||||
{
|
||||
// 2/1
|
||||
for (uInt16 y=0; y<myHeight; y++)
|
||||
{
|
||||
for (uInt16 x=0; x<(myWidth>>2); x++)
|
||||
{
|
||||
if ( *((uInt32 *) sc) != *((uInt32 *) sp) )
|
||||
{
|
||||
pix1 = pal[*sc++]; pix2 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix1; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
pix1 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix2; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
pix2 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix1; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
pix1 = pal[*sc++];
|
||||
*((uInt16 *)d) = pix2; d += pixelstep;
|
||||
*((uInt16 *)d) = OPTPIXAVERAGE(pix1,pix2); d += pixelstep;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc += 4;
|
||||
d += (pixelstep << 3);
|
||||
}
|
||||
sp += 4;
|
||||
}
|
||||
d = pl + linestep;
|
||||
pl = d;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::wipescreen(void)
|
||||
{
|
||||
uInt8 *d;
|
||||
|
||||
if (!SubsystemInited)
|
||||
lateinit();
|
||||
|
||||
if (&(myOSystem->console().mediaSource()) != NULL)
|
||||
{
|
||||
uInt8 *s = myOSystem->console().mediaSource().currentFrameBuffer();
|
||||
memset(s, 0, myWidth*myHeight-1);
|
||||
}
|
||||
|
||||
if ( (d = (uInt8 *) GXBeginDraw()) == NULL )
|
||||
return;
|
||||
for (int i=0; i < scrwidth*scrheight; i++, *((uInt16 *)d) = 0, d += 2);
|
||||
GXEndDraw();
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::postFrameUpdate()
|
||||
{
|
||||
GXEndDraw();
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, OverlayColor color)
|
||||
{
|
||||
GUI::Font* myfont = (GUI::Font*)font;
|
||||
const FontDesc& desc = myfont->desc();
|
||||
|
||||
if (!myDstScreen) return;
|
||||
|
||||
if(c < desc.firstchar || c >= desc.firstchar + desc.size)
|
||||
{
|
||||
if (c == ' ')
|
||||
return;
|
||||
c = desc.defaultchar;
|
||||
}
|
||||
|
||||
const Int32 w = myfont->getCharWidth(c) >> 1;
|
||||
const Int32 h = myfont->getFontHeight();
|
||||
c -= desc.firstchar;
|
||||
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[c] : (c * h));
|
||||
|
||||
if (x<0 || y<0 || (x>>1)+w>scrwidth || y+h>scrheight) return;
|
||||
|
||||
uInt8 *d = myDstScreen + (y/* >> 1*/) * linestep + (x >> 1) * pixelstep;
|
||||
uInt32 stride = (scrwidth - w) * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
uInt16 col2 = (col >> 1) & 0xFFE0;
|
||||
|
||||
for(int y2 = 0; y2 < h; y2++)
|
||||
{
|
||||
const uInt16 buffer = *tmp++;
|
||||
uInt16 mask = 0x8000;
|
||||
|
||||
for(int x2 = 0; x2 < w; x2++, mask >>= 2)
|
||||
{
|
||||
if (((buffer & mask) != 0) ^ ((buffer & mask>>1) != 0))
|
||||
*((uInt16 *)d) = col2;
|
||||
else if (((buffer & mask) != 0) && ((buffer & mask>>1) != 0))
|
||||
*((uInt16 *)d) = col;
|
||||
d += pixelstep;
|
||||
}
|
||||
d += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::scanline(uInt32 row, uInt8* data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::setAspectRatio()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool FrameBufferWinCE::createScreen()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::toggleFilter()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uInt32 FrameBufferWinCE::mapRGB(Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int kx2 = x2>> 1;
|
||||
|
||||
//if (kx<0 || ky<0 || kx2<0 || kx+kx2>scrwidth || ky>scrheight) return;
|
||||
if (kx<0) kx=0; if (ky<0) ky=0; if (ky>scrheight-1) return; if (kx2>scrwidth-1) kx2=scrwidth-1;
|
||||
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
for (;kx < kx2; kx++, *((uInt16 *)d) = col, d += pixelstep);
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int ky2 = y2 /*>> 1*/;
|
||||
|
||||
//if (kx<0 || ky<0 || ky2<0 || ky+ky2>scrheight || kx>scrwidth) return;
|
||||
if (kx<0) kx=0; if (ky<0) ky=0; if (kx>scrwidth-1) return; if (ky2>scrheight-1) ky2=scrheight-1;
|
||||
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
for (;ky < ky2; ky++, *((uInt16 *)d) = col, d += linestep);
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, OverlayColor color)
|
||||
{
|
||||
if (!myDstScreen) return;
|
||||
int kx = x >> 1; int ky = y/* >> 1*/; int kw = (w >> 1) - 1; int kh = h /*>> 1*/;
|
||||
|
||||
//if (kx<0 || ky<0 || kw<0 || kh<0 || kx+kw>scrwidth || ky+kh>scrheight) return;
|
||||
if (kx<0) kx=0; if (ky<0) ky=0;if (kw<0) kw=0; if (kh<0) kh=0;
|
||||
if (kx+kw>scrwidth-1) kw=scrwidth-kx-1; if (ky+kh>scrheight-1) kh=scrheight-ky-1;
|
||||
|
||||
uInt8 *d = myDstScreen + ky * linestep + kx * pixelstep;
|
||||
uInt16 col = guipal[((int) color) - 256];
|
||||
uInt32 stride = (scrwidth - kw - 1) * pixelstep;
|
||||
for (int h2 = kh; h2 >= 0; h2--)
|
||||
{
|
||||
for (int w2 = kw; w2>=0; w2--)
|
||||
{
|
||||
*((uInt16 *)d) = col;
|
||||
d += pixelstep;
|
||||
}
|
||||
d += stride;
|
||||
}
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::drawBitmap(uInt32* bitmap, Int32 x, Int32 y, OverlayColor color, Int32 h)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::translateCoords(Int32* x, Int32* y)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void FrameBufferWinCE::addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uInt32 FrameBufferWinCE::lineDim()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,44 +1,56 @@
|
|||
#ifndef FRAMEBUFFER_WINCE_HXX
|
||||
#define FRAMEBUFFER_WINCE_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
class FrameBufferWinCE : public FrameBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
FrameBufferWinCE(OSystem *osystem);
|
||||
~FrameBufferWinCE();
|
||||
virtual void setPalette(const uInt32* palette);
|
||||
virtual bool initSubsystem();
|
||||
virtual void setAspectRatio() ;
|
||||
virtual bool createScreen();
|
||||
virtual void toggleFilter();
|
||||
virtual void drawMediaSource();
|
||||
virtual void preFrameUpdate();
|
||||
virtual void postFrameUpdate();
|
||||
virtual void scanline(uInt32 row, uInt8* data);
|
||||
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b);
|
||||
virtual void hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color);
|
||||
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color);
|
||||
virtual void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, OverlayColor color);
|
||||
virtual void drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, OverlayColor color);
|
||||
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, OverlayColor color, Int32 h = 8);
|
||||
virtual void translateCoords(Int32* x, Int32* y);
|
||||
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
|
||||
private:
|
||||
|
||||
void FrameBufferWinCE::lateinit(void);
|
||||
|
||||
// uInt32 myXstart, myYstart;
|
||||
// uInt8 *currentFrame, *previousFrame;
|
||||
uInt16 pal[256], myWidth, myHeight, guipal[kNumColors-256], scrwidth, scrheight;
|
||||
uInt32 pixelstep, linestep, displacement;
|
||||
bool SubsystemInited;
|
||||
uInt8 *myDstScreen;
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef FRAMEBUFFER_WINCE_HXX
|
||||
#define FRAMEBUFFER_WINCE_HXX
|
||||
|
||||
#include <gx.h>
|
||||
#include "bspf.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
class FrameBufferWinCE : public FrameBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
FrameBufferWinCE(OSystem *osystem);
|
||||
~FrameBufferWinCE();
|
||||
virtual void setPalette(const uInt32* palette);
|
||||
virtual bool initSubsystem();
|
||||
virtual void setAspectRatio() ;
|
||||
virtual bool createScreen();
|
||||
virtual void toggleFilter();
|
||||
virtual void drawMediaSource();
|
||||
virtual void preFrameUpdate();
|
||||
virtual void postFrameUpdate();
|
||||
virtual void scanline(uInt32 row, uInt8* data);
|
||||
virtual Uint32 mapRGB(Uint8 r, Uint8 g, Uint8 b);
|
||||
virtual void hLine(uInt32 x, uInt32 y, uInt32 x2, OverlayColor color);
|
||||
virtual void vLine(uInt32 x, uInt32 y, uInt32 y2, OverlayColor color);
|
||||
virtual void fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, OverlayColor color);
|
||||
virtual void drawChar(const GUI::Font* font, uInt8 c, uInt32 x, uInt32 y, OverlayColor color);
|
||||
virtual void drawBitmap(uInt32* bitmap, Int32 x, Int32 y, OverlayColor color, Int32 h = 8);
|
||||
virtual void translateCoords(Int32* x, Int32* y);
|
||||
virtual void addDirtyRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h);
|
||||
virtual uInt32 lineDim();
|
||||
void wipescreen(void);
|
||||
void setmode(uInt8 mode);
|
||||
int rotatedisplay(void);
|
||||
|
||||
private:
|
||||
|
||||
void FrameBufferWinCE::lateinit(void);
|
||||
|
||||
// uInt32 myXstart, myYstart;
|
||||
// uInt8 *currentFrame, *previousFrame;
|
||||
uInt16 pal[256], myWidth, myHeight, guipal[kNumColors-256], scrwidth, scrheight;
|
||||
Int32 pixelstep, linestep;
|
||||
uInt32 displacement;
|
||||
bool SubsystemInited;
|
||||
uInt8 *myDstScreen;
|
||||
|
||||
bool issmartphone, islandscape;
|
||||
uInt16 minydim, optgreenmaskN, optgreenmask;
|
||||
Int32 pixelsteptimes5, pixelsteptimes6;
|
||||
GXDisplayProperties gxdp;
|
||||
uInt8 displaymode;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,111 +1,114 @@
|
|||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "OSystemWinCE.hxx"
|
||||
#include "SoundWinCE.hxx"
|
||||
//#include <sstream>
|
||||
extern void KeyCheck(void);
|
||||
int EventHandlerState;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemWinCE::OSystemWinCE()
|
||||
{
|
||||
string basedir = ((string) getcwd()) + '\\';
|
||||
setBaseDir(basedir);
|
||||
|
||||
string stateDir = basedir + "state\\";
|
||||
setStateDir(stateDir);
|
||||
|
||||
setPropertiesDir(basedir, basedir);
|
||||
|
||||
string configFile = basedir + "stella.ini";
|
||||
setConfigFiles(configFile, configFile); // Input and output are the same
|
||||
|
||||
string cacheFile = basedir + "stella.cache";
|
||||
setCacheFile(cacheFile);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemWinCE::~OSystemWinCE()
|
||||
{
|
||||
}
|
||||
|
||||
void OSystemWinCE::setFramerate(uInt32 framerate)
|
||||
{
|
||||
myDisplayFrameRate = framerate;
|
||||
myTimePerFrame = (uInt32)(1000.0 / (double)myDisplayFrameRate);
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystemWinCE::mainLoop()
|
||||
{
|
||||
|
||||
// These variables are common to both timing options
|
||||
// and are needed to calculate the overall frames per second.
|
||||
uInt32 frameTime = 0, numberOfFrames = 0;
|
||||
|
||||
// Set up less accurate timing stuff
|
||||
uInt32 startTime, virtualTime, currentTime;
|
||||
|
||||
// Set the base for the timers
|
||||
virtualTime = GetTickCount();
|
||||
frameTime = 0;
|
||||
|
||||
// Main game loop
|
||||
MSG msg;
|
||||
for(;;)
|
||||
{
|
||||
while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
|
||||
if(myEventHandler->doQuit())
|
||||
break;
|
||||
|
||||
KeyCheck();
|
||||
|
||||
startTime = GetTickCount();
|
||||
|
||||
EventHandlerState = (int) myEventHandler->state();
|
||||
myEventHandler->poll(startTime);
|
||||
myFrameBuffer->update();
|
||||
((SoundWinCE *)mySound)->update();
|
||||
|
||||
currentTime = GetTickCount();
|
||||
virtualTime += myTimePerFrame;
|
||||
if(currentTime < virtualTime)
|
||||
Sleep(virtualTime - currentTime);
|
||||
|
||||
currentTime = GetTickCount() - startTime;
|
||||
frameTime += currentTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
|
||||
/* {
|
||||
double executionTime = (double) frameTime / 1000000.0;
|
||||
double framesPerSecond = (double) numberOfFrames / executionTime;
|
||||
ostringstream a;
|
||||
a << endl;
|
||||
a << numberOfFrames << " total frames drawn\n";
|
||||
a << framesPerSecond << " frames/second\n";
|
||||
a << endl;
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, a.str().c_str(), strlen(a.str().c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
MessageBox(GetDesktopWindow(),unicodeString, _T("..."),0);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
uInt32 OSystemWinCE::getTicks(void)
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "OSystemWinCE.hxx"
|
||||
#include "SoundWinCE.hxx"
|
||||
#include "FrameBufferWinCE.hxx"
|
||||
//#include <sstream>
|
||||
extern void KeyCheck(void);
|
||||
extern int EventHandlerState;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemWinCE::OSystemWinCE()
|
||||
{
|
||||
string basedir = ((string) getcwd()) + '\\';
|
||||
setBaseDir(basedir);
|
||||
|
||||
string stateDir = basedir;// + "state\\";
|
||||
setStateDir(stateDir);
|
||||
|
||||
setPropertiesDir(basedir, basedir);
|
||||
|
||||
string configFile = basedir + "stella.ini";
|
||||
setConfigFiles(configFile, configFile); // Input and output are the same
|
||||
|
||||
string cacheFile = basedir + "stella.cache";
|
||||
setCacheFile(cacheFile);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OSystemWinCE::~OSystemWinCE()
|
||||
{
|
||||
}
|
||||
|
||||
void OSystemWinCE::setFramerate(uInt32 framerate)
|
||||
{
|
||||
myDisplayFrameRate = framerate;
|
||||
myTimePerFrame = (uInt32)(1000.0 / (double)myDisplayFrameRate);
|
||||
}
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystemWinCE::mainLoop()
|
||||
{
|
||||
|
||||
uInt32 frameTime = 0, numberOfFrames = 0;
|
||||
uInt32 startTime, virtualTime, currentTime;
|
||||
|
||||
virtualTime = GetTickCount();
|
||||
frameTime = 0;
|
||||
|
||||
// Main game loop
|
||||
MSG msg;
|
||||
int laststate = -1;
|
||||
for(;;)
|
||||
{
|
||||
while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
if (msg.message == WM_QUIT)
|
||||
break;
|
||||
|
||||
if(myEventHandler->doQuit())
|
||||
break;
|
||||
|
||||
KeyCheck();
|
||||
|
||||
startTime = GetTickCount();
|
||||
|
||||
EventHandlerState = (int) myEventHandler->state();
|
||||
if ((laststate != -1) && (laststate != EventHandlerState) && (EventHandlerState != 2))
|
||||
((FrameBufferWinCE *)myFrameBuffer)->wipescreen();
|
||||
laststate = EventHandlerState;
|
||||
|
||||
myEventHandler->poll(startTime);
|
||||
myFrameBuffer->update();
|
||||
((SoundWinCE *)mySound)->update();
|
||||
|
||||
currentTime = GetTickCount();
|
||||
virtualTime += myTimePerFrame;
|
||||
if(currentTime < virtualTime)
|
||||
Sleep(virtualTime - currentTime);
|
||||
else
|
||||
virtualTime = currentTime;
|
||||
|
||||
currentTime = GetTickCount() - startTime;
|
||||
frameTime += currentTime;
|
||||
++numberOfFrames;
|
||||
}
|
||||
|
||||
/* {
|
||||
double executionTime = (double) frameTime / 1000000.0;
|
||||
double framesPerSecond = (double) numberOfFrames / executionTime;
|
||||
ostringstream a;
|
||||
a << endl;
|
||||
a << numberOfFrames << " total frames drawn\n";
|
||||
a << framesPerSecond << " frames/second\n";
|
||||
a << endl;
|
||||
TCHAR unicodeString[MAX_PATH];
|
||||
MultiByteToWideChar(CP_ACP, 0, a.str().c_str(), strlen(a.str().c_str()) + 1, unicodeString, sizeof(unicodeString));
|
||||
MessageBox(GetDesktopWindow(),unicodeString, _T("..."),0);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
uInt32 OSystemWinCE::getTicks(void)
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#ifndef OSYSTEM_WINCE_HXX
|
||||
#define OSYSTEM_WINCE_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
class OSystemWinCE : public OSystem
|
||||
{
|
||||
public:
|
||||
OSystemWinCE();
|
||||
virtual ~OSystemWinCE();
|
||||
|
||||
public:
|
||||
virtual void mainLoop();
|
||||
virtual uInt32 getTicks(void);
|
||||
virtual void setFramerate(uInt32 framerate);
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef OSYSTEM_WINCE_HXX
|
||||
#define OSYSTEM_WINCE_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "OSystem.hxx"
|
||||
|
||||
class OSystemWinCE : public OSystem
|
||||
{
|
||||
public:
|
||||
OSystemWinCE();
|
||||
virtual ~OSystemWinCE();
|
||||
|
||||
public:
|
||||
virtual void mainLoop();
|
||||
virtual uInt32 getTicks(void);
|
||||
virtual void setFramerate(uInt32 framerate);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,161 +1,171 @@
|
|||
#include <windows.h>
|
||||
#include <gx.h>
|
||||
#include "EventHandler.hxx"
|
||||
#include "OSystemWinCE.hxx"
|
||||
#include "SettingsWinCE.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
#include "FSNode.hxx"
|
||||
|
||||
#define KEYSCHECK_ASYNC
|
||||
|
||||
struct key2event
|
||||
{
|
||||
UINT keycode;
|
||||
SDLKey sdlkey;
|
||||
uInt8 state;
|
||||
SDLKey launcherkey;
|
||||
};
|
||||
extern key2event keycodes[2][MAX_KEYS];
|
||||
extern void KeySetup(void);
|
||||
|
||||
OSystemWinCE* theOSystem = (OSystemWinCE*) NULL;
|
||||
HWND hWnd;
|
||||
|
||||
void KeyCheck(void)
|
||||
{
|
||||
#ifdef KEYSCHECK_ASYNC
|
||||
if (GetAsyncKeyState(keycodes[0][K_QUIT].keycode) & 0x8000)
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
return;
|
||||
}
|
||||
for (int i=0; i<MAX_KEYS-1; i++)
|
||||
keycodes[0][i].state = ((uInt16) GetAsyncKeyState(keycodes[0][i].keycode)) >> 15;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CleanUp(void)
|
||||
{
|
||||
if(theOSystem) delete theOSystem;
|
||||
GXCloseDisplay();
|
||||
GXCloseInput();
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
static PAINTSTRUCT ps;
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_KEYDOWN:
|
||||
#ifndef KEYSCHECK_ASYNC
|
||||
uInt8 i;
|
||||
if (wParam == keycodes[K_QUIT].keycode)
|
||||
PostQuitMessage(0);
|
||||
else
|
||||
for (i=0; i<MAX_KEYS-1; i++)
|
||||
if (wParam == keycodes[i].keycode)
|
||||
{
|
||||
theConsole->eventHandler().event()->set(keycodes[i].event,1);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case WM_KEYUP:
|
||||
#ifndef KEYSCHECK_ASYNC
|
||||
for (i=0; i<MAX_KEYS-1; i++)
|
||||
if (wParam == keycodes[i].keycode)
|
||||
{
|
||||
theConsole->eventHandler().event()->set(keycodes[i].event,0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
case WM_ACTIVATE:
|
||||
GXSuspend();
|
||||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
case WM_HIBERNATE:
|
||||
GXResume();
|
||||
return 0;
|
||||
|
||||
case WM_PAINT:
|
||||
BeginPaint(hWnd, &ps);
|
||||
EndPaint(hWnd, &ps);
|
||||
return 0;
|
||||
|
||||
}
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd )
|
||||
{
|
||||
LPTSTR wndname = _T("PocketStella");
|
||||
WNDCLASS wc = { CS_HREDRAW | CS_VREDRAW, WindowProc, 0, 0, hInstance, NULL, NULL,
|
||||
(HBRUSH)GetStockObject(BLACK_BRUSH), NULL, wndname};
|
||||
RegisterClass(&wc);
|
||||
hWnd = CreateWindow(wndname, wndname, WS_VISIBLE, 0, 0, GetSystemMetrics(SM_CXSCREEN),
|
||||
GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);
|
||||
if (!hWnd) return 1;
|
||||
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
|
||||
MSG msg;
|
||||
while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
theOSystem = new OSystemWinCE();
|
||||
SettingsWinCE theSettings(theOSystem);
|
||||
theOSystem->settings().loadConfig();
|
||||
theOSystem->settings().validate();
|
||||
EventHandler theEventHandler(theOSystem);
|
||||
PropertiesSet propertiesSet;
|
||||
propertiesSet.load(theOSystem->systemProperties(), false);
|
||||
theOSystem->attach(&propertiesSet);
|
||||
|
||||
if ( !GXOpenDisplay(hWnd, GX_FULLSCREEN) || !GXOpenInput() )
|
||||
{
|
||||
CleanUp();
|
||||
return 1;
|
||||
}
|
||||
KeySetup();
|
||||
|
||||
if(!theOSystem->createFrameBuffer())
|
||||
{
|
||||
CleanUp();
|
||||
return 1;
|
||||
}
|
||||
theOSystem->createSound();
|
||||
|
||||
string romfile = ((string) getcwd()) + ((string) "\\") + theSettings.getString("GameFilename");
|
||||
if (!FilesystemNode::fileExists(romfile))
|
||||
theOSystem->createLauncher();
|
||||
else
|
||||
{
|
||||
/*TCHAR tmp[200];
|
||||
MultiByteToWideChar(CP_ACP, 0, romfile.c_str(), strlen(romfile.c_str()) + 1, tmp, 200);
|
||||
MessageBox(hWnd, tmp, _T("..."),0);*/
|
||||
theOSystem->createConsole(romfile);
|
||||
}
|
||||
|
||||
theOSystem->mainLoop();
|
||||
|
||||
CleanUp();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#include <windows.h>
|
||||
#include "EventHandler.hxx"
|
||||
#include "OSystemWinCE.hxx"
|
||||
#include "SettingsWinCE.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
#include "FSNode.hxx"
|
||||
#include "FrameBufferWinCE.hxx"
|
||||
|
||||
#define KEYSCHECK_ASYNC
|
||||
|
||||
struct key2event
|
||||
{
|
||||
UINT keycode;
|
||||
SDLKey sdlkey;
|
||||
uInt8 state;
|
||||
SDLKey launcherkey;
|
||||
};
|
||||
extern key2event keycodes[2][MAX_KEYS];
|
||||
extern void KeySetup(void);
|
||||
extern void KeySetMode(int);
|
||||
|
||||
OSystemWinCE* theOSystem = (OSystemWinCE*) NULL;
|
||||
HWND hWnd;
|
||||
uInt16 rotkeystate = 0;
|
||||
|
||||
|
||||
void KeyCheck(void)
|
||||
{
|
||||
#ifdef KEYSCHECK_ASYNC
|
||||
if (GetAsyncKeyState(VK_F3))
|
||||
{
|
||||
if (rotkeystate == 0)
|
||||
KeySetMode( ((FrameBufferWinCE *) (&(theOSystem->frameBuffer())))->rotatedisplay() );
|
||||
rotkeystate = 1;
|
||||
}
|
||||
else
|
||||
rotkeystate = 0;
|
||||
|
||||
for (int i=0; i<MAX_KEYS; i++)
|
||||
if (GetAsyncKeyState(keycodes[0][i].keycode))
|
||||
keycodes[0][i].state = 1;
|
||||
else
|
||||
keycodes[0][i].state = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CleanUp(void)
|
||||
{
|
||||
if(theOSystem) delete theOSystem;
|
||||
GXCloseDisplay();
|
||||
GXCloseInput();
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_F3)
|
||||
{
|
||||
if (rotkeystate == 0)
|
||||
KeySetMode( ((FrameBufferWinCE *) (&(theOSystem->frameBuffer())))->rotatedisplay() );
|
||||
rotkeystate = 1;
|
||||
}
|
||||
else
|
||||
rotkeystate = 0;
|
||||
#ifndef KEYSCHECK_ASYNC
|
||||
uInt8 i;
|
||||
for (i=0; i<MAX_KEYS; i++)
|
||||
if (wParam == keycodes[0][i].keycode)
|
||||
keycodes[0][i].state = 1;
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case WM_KEYUP:
|
||||
#ifndef KEYSCHECK_ASYNC
|
||||
for (i=0; i<MAX_KEYS; i++)
|
||||
if (wParam == keycodes[0][i].keycode)
|
||||
keycodes[0][i].state = 0;
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
case WM_ACTIVATE:
|
||||
GXSuspend();
|
||||
return 0;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
case WM_HIBERNATE:
|
||||
GXResume();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd )
|
||||
{
|
||||
LPTSTR wndname = _T("PocketStella");
|
||||
WNDCLASS wc = { CS_HREDRAW | CS_VREDRAW, WindowProc, 0, 0, hInstance, NULL, NULL,
|
||||
(HBRUSH)GetStockObject(BLACK_BRUSH), NULL, wndname};
|
||||
RegisterClass(&wc);
|
||||
hWnd = CreateWindow(wndname, wndname, WS_VISIBLE, 0, 0, GetSystemMetrics(SM_CXSCREEN),
|
||||
GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);
|
||||
if (!hWnd) return 1;
|
||||
SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
||||
|
||||
MSG msg;
|
||||
while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
LOGFONT f = {11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
|
||||
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, _T("")};
|
||||
HFONT hFnt = CreateFontIndirect(&f);
|
||||
HDC hDC = GetDC(hWnd);
|
||||
SelectObject(hDC, hFnt);
|
||||
RECT RWnd;
|
||||
GetClipBox(hDC, &RWnd);
|
||||
SetTextColor(hDC, 0xA0A0A0);
|
||||
SetBkColor(hDC, 0);
|
||||
DrawText(hDC, _T("PocketStella Initializing..."), -1, &RWnd, DT_CENTER | DT_VCENTER);
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DeleteObject(hFnt);
|
||||
|
||||
theOSystem = new OSystemWinCE();
|
||||
SettingsWinCE theSettings(theOSystem);
|
||||
theOSystem->settings().loadConfig();
|
||||
theOSystem->settings().validate();
|
||||
EventHandler theEventHandler(theOSystem);
|
||||
PropertiesSet propertiesSet;
|
||||
propertiesSet.load(theOSystem->systemProperties(), false);
|
||||
theOSystem->attach(&propertiesSet);
|
||||
|
||||
if ( !GXOpenDisplay(hWnd, GX_FULLSCREEN) || !GXOpenInput() )
|
||||
{
|
||||
CleanUp();
|
||||
return 1;
|
||||
}
|
||||
KeySetup();
|
||||
|
||||
if(!theOSystem->createFrameBuffer())
|
||||
{
|
||||
CleanUp();
|
||||
return 1;
|
||||
}
|
||||
theOSystem->createSound();
|
||||
|
||||
string romfile = ((string) getcwd()) + ((string) "\\") + theSettings.getString("GameFilename");
|
||||
if (!FilesystemNode::fileExists(romfile))
|
||||
theOSystem->createLauncher();
|
||||
else
|
||||
theOSystem->createConsole(romfile);
|
||||
|
||||
theOSystem->mainLoop();
|
||||
|
||||
CleanUp();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,19 +1,19 @@
|
|||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "SettingsWinCE.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsWinCE::SettingsWinCE(OSystem* osystem) : Settings(osystem)
|
||||
{
|
||||
//set("GameFilename", "Mega Force (1982) (20th Century Fox).bin");
|
||||
//set("GameFilename", "Enduro (1983) (Activision).bin");
|
||||
//set("GameFilename", "Night Driver (1978) (Atari).bin");
|
||||
set("romdir", (string) getcwd() + '\\');
|
||||
}
|
||||
|
||||
SettingsWinCE::~SettingsWinCE()
|
||||
{
|
||||
}
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "SettingsWinCE.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SettingsWinCE::SettingsWinCE(OSystem* osystem) : Settings(osystem)
|
||||
{
|
||||
//set("GameFilename", "Mega Force (1982) (20th Century Fox).bin");
|
||||
//set("GameFilename", "Enduro (1983) (Activision).bin");
|
||||
//set("GameFilename", "Night Driver (1978) (Atari).bin");
|
||||
set("romdir", (string) getcwd() + '\\');
|
||||
}
|
||||
|
||||
SettingsWinCE::~SettingsWinCE()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#ifndef SETTINGS_WINCE_HXX
|
||||
#define SETTINGS_WINCE_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
|
||||
class SettingsWinCE : public Settings
|
||||
{
|
||||
public:
|
||||
SettingsWinCE(OSystem* osystem);
|
||||
virtual ~SettingsWinCE();
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef SETTINGS_WINCE_HXX
|
||||
#define SETTINGS_WINCE_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Settings.hxx"
|
||||
|
||||
class SettingsWinCE : public Settings
|
||||
{
|
||||
public:
|
||||
SettingsWinCE(OSystem* osystem);
|
||||
virtual ~SettingsWinCE();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,378 +1,392 @@
|
|||
#ifdef SOUND_SUPPORT
|
||||
|
||||
#include "TIASnd.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "System.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "TIASnd.hxx"
|
||||
|
||||
#include "SoundWinCE.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::SoundWinCE(OSystem* osystem)
|
||||
: Sound(osystem),
|
||||
myIsEnabled(osystem->settings().getBool("sound")),
|
||||
myIsInitializedFlag(false),
|
||||
myLastRegisterSetCycle(0),
|
||||
myDisplayFrameRate(60),
|
||||
myNumChannels(1),
|
||||
myFragmentSizeLogBase2(0),
|
||||
myIsMuted(false),
|
||||
myVolume(100),
|
||||
myLatency(100), myMixRate(22050), myBuffnum(0)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::~SoundWinCE()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setEnabled(bool state)
|
||||
{
|
||||
myIsEnabled = state;
|
||||
myOSystem->settings().setBool("sound", state);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::initialize()
|
||||
{
|
||||
if(!myIsEnabled)
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
myRegWriteQueue.clear();
|
||||
myTIASound.reset();
|
||||
|
||||
// init wave out
|
||||
WAVEFORMATEX wf;
|
||||
MMRESULT err;
|
||||
memset(&wf, 0, sizeof(wf));
|
||||
wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wf.nChannels = 1;
|
||||
wf.nSamplesPerSec = myMixRate;
|
||||
wf.nAvgBytesPerSec = myMixRate;
|
||||
wf.nBlockAlign = 2;
|
||||
wf.wBitsPerSample = 8;
|
||||
wf.cbSize = 0;
|
||||
err = waveOutOpen(&myWout, WAVE_MAPPER, &wf, NULL, NULL, CALLBACK_NULL);
|
||||
if (err != MMSYSERR_NOERROR)
|
||||
return;
|
||||
|
||||
myBuffnum = ((wf.nAvgBytesPerSec * myLatency / 1000) >> 9) + 1;
|
||||
myBuffers = (WAVEHDR *) malloc(myBuffnum * sizeof(*myBuffers));
|
||||
for (int i = 0; i < myBuffnum; i++)
|
||||
{
|
||||
memset(&myBuffers[i], 0, sizeof (myBuffers[i]));
|
||||
if (!(myBuffers[i].lpData = (LPSTR) malloc(512)))
|
||||
return;
|
||||
memset(myBuffers[i].lpData, 128, 512);
|
||||
myBuffers[i].dwBufferLength = 512;
|
||||
err = waveOutPrepareHeader(myWout, &myBuffers[i], sizeof(myBuffers[i]));
|
||||
if (err != MMSYSERR_NOERROR)
|
||||
return;
|
||||
myBuffers[i].dwFlags |= WHDR_DONE;
|
||||
}
|
||||
|
||||
myIsInitializedFlag = true;
|
||||
myIsMuted = false;
|
||||
|
||||
myTIASound.outputFrequency(myMixRate);
|
||||
myTIASound.channels(1);
|
||||
|
||||
for (i=0; i<myBuffnum; i++)
|
||||
waveOutWrite(myWout, &myBuffers[i], sizeof(WAVEHDR));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::close()
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
int flag;
|
||||
do
|
||||
{
|
||||
flag = true;
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
{
|
||||
if (!(myBuffers[i].dwFlags & WHDR_DONE))
|
||||
{
|
||||
flag = false;
|
||||
Sleep(myLatency);
|
||||
}
|
||||
}
|
||||
} while (flag = false);
|
||||
|
||||
waveOutReset(myWout);
|
||||
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
{
|
||||
if (waveOutUnprepareHeader(myWout, &myBuffers[i], sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
|
||||
return;
|
||||
free(myBuffers[i].lpData);
|
||||
}
|
||||
free(myBuffers);
|
||||
waveOutClose(myWout);
|
||||
|
||||
myIsInitializedFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::isSuccessfullyInitialized() const
|
||||
{
|
||||
return myIsInitializedFlag;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::mute(bool state)
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
if(myIsMuted == state)
|
||||
return;
|
||||
myIsMuted = state;
|
||||
myRegWriteQueue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::reset()
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
myIsMuted = false;
|
||||
myLastRegisterSetCycle = 0;
|
||||
myRegWriteQueue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setVolume(Int32 percent)
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
if((percent >= 0) && (percent <= 100))
|
||||
{
|
||||
myOSystem->settings().setInt("volume", percent);
|
||||
myVolume = percent;
|
||||
myTIASound.volume(percent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::adjustVolume(Int8 direction)
|
||||
{
|
||||
Int32 percent = myVolume;
|
||||
|
||||
if(direction == -1)
|
||||
percent -= 2;
|
||||
else if(direction == 1)
|
||||
percent += 2;
|
||||
|
||||
if((percent < 0) || (percent > 100))
|
||||
return;
|
||||
|
||||
setVolume(percent);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::adjustCycleCounter(Int32 amount)
|
||||
{
|
||||
myLastRegisterSetCycle += amount;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setChannels(uInt32 channels)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setFrameRate(uInt32 framerate)
|
||||
{
|
||||
myDisplayFrameRate = framerate;
|
||||
myLastRegisterSetCycle = 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::set(uInt16 addr, uInt8 value, Int32 cycle)
|
||||
{
|
||||
float delta = (((double)(cycle - myLastRegisterSetCycle)) / (1193191.66666667));
|
||||
delta = delta * (myDisplayFrameRate / (double)myOSystem->frameRate());
|
||||
RegWrite info;
|
||||
info.addr = addr;
|
||||
info.value = value;
|
||||
info.delta = delta;
|
||||
myRegWriteQueue.enqueue(info);
|
||||
myLastRegisterSetCycle = cycle;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::processFragment(uInt8* stream, Int32 length)
|
||||
{
|
||||
if(!myIsInitializedFlag)
|
||||
return;
|
||||
|
||||
float position = 0.0;
|
||||
float remaining = length;
|
||||
|
||||
while(remaining > 0.0)
|
||||
{
|
||||
if(myRegWriteQueue.size() == 0)
|
||||
{
|
||||
myTIASound.process(stream + ((uInt32)position),length - (uInt32)position);
|
||||
myLastRegisterSetCycle = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
RegWrite& info = myRegWriteQueue.front();
|
||||
float duration = remaining / (float) myMixRate;
|
||||
if(info.delta <= duration)
|
||||
{
|
||||
if(info.delta > 0.0)
|
||||
{
|
||||
float samples = (myMixRate * info.delta);
|
||||
myTIASound.process(stream + ((uInt32)position),
|
||||
(uInt32)samples + (uInt32)(position + samples) -
|
||||
((uInt32)position + (uInt32)samples));
|
||||
position += samples;
|
||||
remaining -= samples;
|
||||
}
|
||||
myTIASound.set(info.addr, info.value);
|
||||
myRegWriteQueue.dequeue();
|
||||
}
|
||||
else
|
||||
{
|
||||
myTIASound.process(stream + ((uInt32)position), length - (uInt32)position);
|
||||
info.delta -= duration;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
/*void CALLBACK SoundWinCE::waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance,
|
||||
DWORD dwParam1, DWORD dwParam2)
|
||||
{
|
||||
if (uMsg == WOM_DONE)
|
||||
{
|
||||
SoundWinCE *sound = (SoundWinCE *) dwInstance;
|
||||
sound->processFragment( (uInt8 *) ((WAVEHDR *) dwParam2)->lpData, 512);
|
||||
waveOutWrite(sound->myWout, (WAVEHDR *) dwParam2, sizeof(WAVEHDR));
|
||||
}
|
||||
}
|
||||
*/
|
||||
void SoundWinCE::update(void)
|
||||
{
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
if (myBuffers[i].dwFlags & WHDR_DONE)
|
||||
{
|
||||
processFragment((uInt8 *) myBuffers[i].lpData, 512);
|
||||
waveOutWrite(myWout, &myBuffers[i], sizeof(WAVEHDR));
|
||||
}
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::load(Deserializer& in)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::save(Serializer& out)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::RegWriteQueue::RegWriteQueue(uInt32 capacity)
|
||||
: myCapacity(capacity),
|
||||
myBuffer(0),
|
||||
mySize(0),
|
||||
myHead(0),
|
||||
myTail(0)
|
||||
{
|
||||
myBuffer = new RegWrite[myCapacity];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::RegWriteQueue::~RegWriteQueue()
|
||||
{
|
||||
delete[] myBuffer;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::clear()
|
||||
{
|
||||
myHead = myTail = mySize = 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::dequeue()
|
||||
{
|
||||
if(mySize > 0)
|
||||
{
|
||||
myHead = (myHead + 1) % myCapacity;
|
||||
--mySize;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
float SoundWinCE::RegWriteQueue::duration()
|
||||
{
|
||||
float duration = 0.0;
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
{
|
||||
duration += myBuffer[(myHead + i) % myCapacity].delta;
|
||||
}
|
||||
return duration;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::enqueue(const RegWrite& info)
|
||||
{
|
||||
if(mySize == myCapacity)
|
||||
grow();
|
||||
myBuffer[myTail] = info;
|
||||
myTail = (myTail + 1) % myCapacity;
|
||||
++mySize;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RegWrite& SoundWinCE::RegWriteQueue::front()
|
||||
{
|
||||
assert(mySize != 0);
|
||||
return myBuffer[myHead];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 SoundWinCE::RegWriteQueue::size() const
|
||||
{
|
||||
return mySize;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::grow()
|
||||
{
|
||||
RegWrite* buffer = new RegWrite[myCapacity * 2];
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
{
|
||||
buffer[i] = myBuffer[(myHead + i) % myCapacity];
|
||||
}
|
||||
myHead = 0;
|
||||
myTail = mySize;
|
||||
myCapacity = myCapacity * 2;
|
||||
delete[] myBuffer;
|
||||
myBuffer = buffer;
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
||||
#include "TIASnd.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Deserializer.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "System.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "TIASnd.hxx"
|
||||
|
||||
#include "SoundWinCE.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::SoundWinCE(OSystem* osystem)
|
||||
: Sound(osystem),
|
||||
myIsEnabled(osystem->settings().getBool("sound")),
|
||||
myIsInitializedFlag(false),
|
||||
myLastRegisterSetCycle(0),
|
||||
myDisplayFrameRate(60),
|
||||
myNumChannels(1),
|
||||
myFragmentSizeLogBase2(0),
|
||||
myIsMuted(false),
|
||||
myVolume(100),
|
||||
myLatency(100), myMixRate(22050), myBuffnum(0)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::~SoundWinCE()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setEnabled(bool state)
|
||||
{
|
||||
myIsEnabled = state;
|
||||
myOSystem->settings().setBool("sound", state);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::initialize()
|
||||
{
|
||||
if(!myIsEnabled)
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
myRegWriteQueue.clear();
|
||||
myTIASound.reset();
|
||||
|
||||
// init wave out
|
||||
WAVEFORMATEX wf;
|
||||
MMRESULT err;
|
||||
memset(&wf, 0, sizeof(wf));
|
||||
wf.wFormatTag = WAVE_FORMAT_PCM;
|
||||
wf.nChannels = 1;
|
||||
wf.nSamplesPerSec = myMixRate;
|
||||
wf.nAvgBytesPerSec = myMixRate;
|
||||
wf.nBlockAlign = 2;
|
||||
wf.wBitsPerSample = 8;
|
||||
wf.cbSize = 0;
|
||||
err = waveOutOpen(&myWout, WAVE_MAPPER, &wf, NULL, NULL, CALLBACK_NULL);
|
||||
if (err != MMSYSERR_NOERROR)
|
||||
return;
|
||||
|
||||
myBuffnum = ((wf.nAvgBytesPerSec * myLatency / 1000) >> 9) + 1;
|
||||
myBuffers = (WAVEHDR *) malloc(myBuffnum * sizeof(*myBuffers));
|
||||
for (int i = 0; i < myBuffnum; i++)
|
||||
{
|
||||
memset(&myBuffers[i], 0, sizeof (myBuffers[i]));
|
||||
if (!(myBuffers[i].lpData = (LPSTR) malloc(512)))
|
||||
return;
|
||||
memset(myBuffers[i].lpData, 128, 512);
|
||||
myBuffers[i].dwBufferLength = 512;
|
||||
err = waveOutPrepareHeader(myWout, &myBuffers[i], sizeof(myBuffers[i]));
|
||||
if (err != MMSYSERR_NOERROR)
|
||||
return;
|
||||
myBuffers[i].dwFlags |= WHDR_DONE;
|
||||
}
|
||||
|
||||
myIsInitializedFlag = true;
|
||||
myIsMuted = false;
|
||||
|
||||
myTIASound.outputFrequency(myMixRate);
|
||||
myTIASound.channels(1);
|
||||
|
||||
for (i=0; i<myBuffnum; i++)
|
||||
waveOutWrite(myWout, &myBuffers[i], sizeof(WAVEHDR));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::close()
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
int flag;
|
||||
do
|
||||
{
|
||||
flag = true;
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
{
|
||||
if (!(myBuffers[i].dwFlags & WHDR_DONE))
|
||||
{
|
||||
flag = false;
|
||||
Sleep(myLatency);
|
||||
}
|
||||
}
|
||||
} while (flag = false);
|
||||
|
||||
waveOutReset(myWout);
|
||||
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
{
|
||||
if (waveOutUnprepareHeader(myWout, &myBuffers[i], sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
|
||||
return;
|
||||
free(myBuffers[i].lpData);
|
||||
}
|
||||
free(myBuffers);
|
||||
waveOutClose(myWout);
|
||||
|
||||
myIsInitializedFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::isSuccessfullyInitialized() const
|
||||
{
|
||||
return myIsInitializedFlag;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::mute(bool state)
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
if(myIsMuted == state)
|
||||
return;
|
||||
myIsMuted = state;
|
||||
myRegWriteQueue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::reset()
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
myIsMuted = false;
|
||||
myLastRegisterSetCycle = 0;
|
||||
myRegWriteQueue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setVolume(Int32 percent)
|
||||
{
|
||||
if(myIsInitializedFlag)
|
||||
{
|
||||
if((percent >= 0) && (percent <= 100))
|
||||
{
|
||||
myOSystem->settings().setInt("volume", percent);
|
||||
myVolume = percent;
|
||||
myTIASound.volume(percent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::adjustVolume(Int8 direction)
|
||||
{
|
||||
Int32 percent = myVolume;
|
||||
|
||||
if(direction == -1)
|
||||
percent -= 2;
|
||||
else if(direction == 1)
|
||||
percent += 2;
|
||||
|
||||
if((percent < 0) || (percent > 100))
|
||||
return;
|
||||
|
||||
setVolume(percent);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::adjustCycleCounter(Int32 amount)
|
||||
{
|
||||
myLastRegisterSetCycle += amount;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setChannels(uInt32 channels)
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::setFrameRate(uInt32 framerate)
|
||||
{
|
||||
myDisplayFrameRate = framerate;
|
||||
myLastRegisterSetCycle = 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::set(uInt16 addr, uInt8 value, Int32 cycle)
|
||||
{
|
||||
float delta = (((double)(cycle - myLastRegisterSetCycle)) / (1193191.66666667));
|
||||
delta = delta * (myDisplayFrameRate / (double)myOSystem->frameRate());
|
||||
RegWrite info;
|
||||
info.addr = addr;
|
||||
info.value = value;
|
||||
info.delta = delta;
|
||||
myRegWriteQueue.enqueue(info);
|
||||
myLastRegisterSetCycle = cycle;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::processFragment(uInt8* stream, Int32 length)
|
||||
{
|
||||
if(!myIsInitializedFlag)
|
||||
return;
|
||||
|
||||
float position = 0.0;
|
||||
float remaining = length;
|
||||
|
||||
if(myRegWriteQueue.duration() >
|
||||
(9.0 / myDisplayFrameRate))
|
||||
{
|
||||
float removed = 0.0;
|
||||
while(removed < ((9.0 - 1) / myDisplayFrameRate))
|
||||
{
|
||||
RegWrite& info = myRegWriteQueue.front();
|
||||
removed += info.delta;
|
||||
myTIASound.set(info.addr, info.value);
|
||||
myRegWriteQueue.dequeue();
|
||||
}
|
||||
// cout << "Removed Items from RegWriteQueue!" << endl;
|
||||
}
|
||||
|
||||
while(remaining > 0.0)
|
||||
{
|
||||
if(myRegWriteQueue.size() == 0)
|
||||
{
|
||||
myTIASound.process(stream + ((uInt32)position),length - (uInt32)position);
|
||||
myLastRegisterSetCycle = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
RegWrite& info = myRegWriteQueue.front();
|
||||
float duration = remaining / (float) myMixRate;
|
||||
if(info.delta <= duration)
|
||||
{
|
||||
if(info.delta > 0.0)
|
||||
{
|
||||
float samples = (myMixRate * info.delta);
|
||||
myTIASound.process(stream + ((uInt32)position),
|
||||
(uInt32)samples + (uInt32)(position + samples) -
|
||||
((uInt32)position + (uInt32)samples));
|
||||
position += samples;
|
||||
remaining -= samples;
|
||||
}
|
||||
myTIASound.set(info.addr, info.value);
|
||||
myRegWriteQueue.dequeue();
|
||||
}
|
||||
else
|
||||
{
|
||||
myTIASound.process(stream + ((uInt32)position), length - (uInt32)position);
|
||||
info.delta -= duration;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
/*void CALLBACK SoundWinCE::waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance,
|
||||
DWORD dwParam1, DWORD dwParam2)
|
||||
{
|
||||
if (uMsg == WOM_DONE)
|
||||
{
|
||||
SoundWinCE *sound = (SoundWinCE *) dwInstance;
|
||||
sound->processFragment( (uInt8 *) ((WAVEHDR *) dwParam2)->lpData, 512);
|
||||
waveOutWrite(sound->myWout, (WAVEHDR *) dwParam2, sizeof(WAVEHDR));
|
||||
}
|
||||
}
|
||||
*/
|
||||
void SoundWinCE::update(void)
|
||||
{
|
||||
for (int i=0; i<myBuffnum; i++)
|
||||
if (myBuffers[i].dwFlags & WHDR_DONE)
|
||||
{
|
||||
processFragment((uInt8 *) myBuffers[i].lpData, 512);
|
||||
waveOutWrite(myWout, &myBuffers[i], sizeof(WAVEHDR));
|
||||
}
|
||||
}
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::load(Deserializer& in)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SoundWinCE::save(Serializer& out)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::RegWriteQueue::RegWriteQueue(uInt32 capacity)
|
||||
: myCapacity(capacity),
|
||||
myBuffer(0),
|
||||
mySize(0),
|
||||
myHead(0),
|
||||
myTail(0)
|
||||
{
|
||||
myBuffer = new RegWrite[myCapacity];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SoundWinCE::RegWriteQueue::~RegWriteQueue()
|
||||
{
|
||||
delete[] myBuffer;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::clear()
|
||||
{
|
||||
myHead = myTail = mySize = 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::dequeue()
|
||||
{
|
||||
if(mySize > 0)
|
||||
{
|
||||
myHead = (myHead + 1) % myCapacity;
|
||||
--mySize;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
float SoundWinCE::RegWriteQueue::duration()
|
||||
{
|
||||
float duration = 0.0;
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
{
|
||||
duration += myBuffer[(myHead + i) % myCapacity].delta;
|
||||
}
|
||||
return duration;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::enqueue(const RegWrite& info)
|
||||
{
|
||||
if(mySize == myCapacity)
|
||||
grow();
|
||||
myBuffer[myTail] = info;
|
||||
myTail = (myTail + 1) % myCapacity;
|
||||
++mySize;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RegWrite& SoundWinCE::RegWriteQueue::front()
|
||||
{
|
||||
assert(mySize != 0);
|
||||
return myBuffer[myHead];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 SoundWinCE::RegWriteQueue::size() const
|
||||
{
|
||||
return mySize;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundWinCE::RegWriteQueue::grow()
|
||||
{
|
||||
RegWrite* buffer = new RegWrite[myCapacity * 2];
|
||||
for(uInt32 i = 0; i < mySize; ++i)
|
||||
{
|
||||
buffer[i] = myBuffer[(myHead + i) % myCapacity];
|
||||
}
|
||||
myHead = 0;
|
||||
myTail = mySize;
|
||||
myCapacity = myCapacity * 2;
|
||||
delete[] myBuffer;
|
||||
myBuffer = buffer;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,86 +1,86 @@
|
|||
#ifndef SOUNDWINCE_HXX
|
||||
#define SOUNDWINCE_HXX
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
||||
class OSystem;
|
||||
|
||||
#include "Sound.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "MediaSrc.hxx"
|
||||
#include "TIASnd.hxx"
|
||||
|
||||
struct RegWrite
|
||||
{
|
||||
uInt16 addr;
|
||||
uInt8 value;
|
||||
double delta;
|
||||
};
|
||||
|
||||
|
||||
class SoundWinCE : public Sound
|
||||
{
|
||||
public:
|
||||
SoundWinCE(OSystem* osystem);
|
||||
virtual ~SoundWinCE();
|
||||
void setEnabled(bool state);
|
||||
void adjustCycleCounter(Int32 amount);
|
||||
void setChannels(uInt32 channels);
|
||||
void setFrameRate(uInt32 framerate);
|
||||
void initialize();
|
||||
void close();
|
||||
bool isSuccessfullyInitialized() const;
|
||||
void mute(bool state);
|
||||
void reset();
|
||||
void set(uInt16 addr, uInt8 value, Int32 cycle);
|
||||
void setVolume(Int32 percent);
|
||||
void adjustVolume(Int8 direction);
|
||||
bool load(Deserializer& in);
|
||||
bool save(Serializer& out);
|
||||
void update(void);
|
||||
|
||||
protected:
|
||||
void processFragment(uInt8* stream, Int32 length);
|
||||
// Struct to hold information regarding a TIA sound register write
|
||||
class RegWriteQueue
|
||||
{
|
||||
public:
|
||||
RegWriteQueue(uInt32 capacity = 512);
|
||||
virtual ~RegWriteQueue();
|
||||
void clear();
|
||||
void dequeue();
|
||||
float duration();
|
||||
void enqueue(const RegWrite& info);
|
||||
RegWrite& front();
|
||||
uInt32 size() const;
|
||||
|
||||
private:
|
||||
void grow();
|
||||
|
||||
private:
|
||||
uInt32 myCapacity;
|
||||
RegWrite* myBuffer;
|
||||
uInt32 mySize;
|
||||
uInt32 myHead;
|
||||
uInt32 myTail;
|
||||
};
|
||||
|
||||
private:
|
||||
TIASound myTIASound;
|
||||
bool myIsEnabled;
|
||||
bool myIsInitializedFlag;
|
||||
Int32 myLastRegisterSetCycle;
|
||||
uInt32 myDisplayFrameRate;
|
||||
uInt32 myNumChannels;
|
||||
double myFragmentSizeLogBase2;
|
||||
bool myIsMuted;
|
||||
uInt32 myVolume;
|
||||
RegWriteQueue myRegWriteQueue;
|
||||
//static void CALLBACK SoundWinCE::waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
|
||||
int myLatency, myMixRate, myBuffnum;
|
||||
WAVEHDR *myBuffers;
|
||||
HWAVEOUT myWout;
|
||||
};
|
||||
|
||||
#endif // SOUND_SUPPORT
|
||||
#endif
|
||||
#ifndef SOUNDWINCE_HXX
|
||||
#define SOUNDWINCE_HXX
|
||||
|
||||
#ifdef SOUND_SUPPORT
|
||||
|
||||
class OSystem;
|
||||
|
||||
#include "Sound.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "MediaSrc.hxx"
|
||||
#include "TIASnd.hxx"
|
||||
|
||||
struct RegWrite
|
||||
{
|
||||
uInt16 addr;
|
||||
uInt8 value;
|
||||
double delta;
|
||||
};
|
||||
|
||||
|
||||
class SoundWinCE : public Sound
|
||||
{
|
||||
public:
|
||||
SoundWinCE(OSystem* osystem);
|
||||
virtual ~SoundWinCE();
|
||||
void setEnabled(bool state);
|
||||
void adjustCycleCounter(Int32 amount);
|
||||
void setChannels(uInt32 channels);
|
||||
void setFrameRate(uInt32 framerate);
|
||||
void initialize();
|
||||
void close();
|
||||
bool isSuccessfullyInitialized() const;
|
||||
void mute(bool state);
|
||||
void reset();
|
||||
void set(uInt16 addr, uInt8 value, Int32 cycle);
|
||||
void setVolume(Int32 percent);
|
||||
void adjustVolume(Int8 direction);
|
||||
bool load(Deserializer& in);
|
||||
bool save(Serializer& out);
|
||||
void update(void);
|
||||
|
||||
protected:
|
||||
void processFragment(uInt8* stream, Int32 length);
|
||||
// Struct to hold information regarding a TIA sound register write
|
||||
class RegWriteQueue
|
||||
{
|
||||
public:
|
||||
RegWriteQueue(uInt32 capacity = 512);
|
||||
virtual ~RegWriteQueue();
|
||||
void clear();
|
||||
void dequeue();
|
||||
float duration();
|
||||
void enqueue(const RegWrite& info);
|
||||
RegWrite& front();
|
||||
uInt32 size() const;
|
||||
|
||||
private:
|
||||
void grow();
|
||||
|
||||
private:
|
||||
uInt32 myCapacity;
|
||||
RegWrite* myBuffer;
|
||||
uInt32 mySize;
|
||||
uInt32 myHead;
|
||||
uInt32 myTail;
|
||||
};
|
||||
|
||||
private:
|
||||
TIASound myTIASound;
|
||||
bool myIsEnabled;
|
||||
bool myIsInitializedFlag;
|
||||
Int32 myLastRegisterSetCycle;
|
||||
uInt32 myDisplayFrameRate;
|
||||
uInt32 myNumChannels;
|
||||
double myFragmentSizeLogBase2;
|
||||
bool myIsMuted;
|
||||
uInt32 myVolume;
|
||||
RegWriteQueue myRegWriteQueue;
|
||||
//static void CALLBACK SoundWinCE::waveOutProc(HWAVEOUT hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2);
|
||||
int myLatency, myMixRate, myBuffnum;
|
||||
WAVEHDR *myBuffers;
|
||||
HWAVEOUT myWout;
|
||||
};
|
||||
|
||||
#endif // SOUND_SUPPORT
|
||||
#endif
|
||||
|
|
|
@ -1,113 +1,146 @@
|
|||
#include "bspf.hxx"
|
||||
#include "SDL.h"
|
||||
#include "gx.h"
|
||||
|
||||
char *msg = NULL;
|
||||
extern int EventHandlerState;
|
||||
|
||||
int time(int dummy)
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
||||
|
||||
char *getcwd(void)
|
||||
{
|
||||
TCHAR fileUnc[MAX_PATH+1];
|
||||
static char cwd[MAX_PATH+1] = "";
|
||||
char *plast;
|
||||
|
||||
// if(cwd[0] == 0)
|
||||
// {
|
||||
GetModuleFileName(NULL, fileUnc, MAX_PATH);
|
||||
WideCharToMultiByte(CP_ACP, 0, fileUnc, -1, cwd, MAX_PATH, NULL, NULL);
|
||||
plast = strrchr(cwd, '\\');
|
||||
if(plast)
|
||||
*plast = 0;
|
||||
|
||||
// }
|
||||
|
||||
return cwd;
|
||||
}
|
||||
|
||||
|
||||
struct key2event
|
||||
{
|
||||
UINT keycode;
|
||||
SDLKey sdlkey;
|
||||
uInt8 state;
|
||||
SDLKey launcherkey;
|
||||
};
|
||||
key2event keycodes[2][MAX_KEYS];
|
||||
|
||||
void KeySetup(void)
|
||||
{
|
||||
GXKeyList klist = GXGetDefaultKeys(GX_NORMALKEYS);
|
||||
|
||||
for (int i=0; i<2; i++)
|
||||
{
|
||||
for (int j=0; j<MAX_KEYS; j++, keycodes[i][j].state = 0,
|
||||
keycodes[i][j].launcherkey = SDLK_UNKNOWN);
|
||||
|
||||
keycodes[i][K_UP].keycode = klist.vkUp;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkDown;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkLeft;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkRight;
|
||||
keycodes[i][K_FIRE].keycode = klist.vkA;
|
||||
keycodes[i][K_RESET].keycode = klist.vkStart;
|
||||
keycodes[i][K_SELECT].keycode = klist.vkB;
|
||||
keycodes[i][K_QUIT].keycode = klist.vkC;
|
||||
|
||||
keycodes[i][K_UP].sdlkey = SDLK_UP;
|
||||
keycodes[i][K_DOWN].sdlkey = SDLK_DOWN;
|
||||
keycodes[i][K_LEFT].sdlkey = SDLK_LEFT;
|
||||
keycodes[i][K_RIGHT].sdlkey = SDLK_RIGHT;
|
||||
keycodes[i][K_FIRE].sdlkey = SDLK_SPACE;
|
||||
keycodes[i][K_RESET].sdlkey = SDLK_F2;
|
||||
keycodes[i][K_SELECT].sdlkey = SDLK_F1;
|
||||
keycodes[i][K_QUIT].sdlkey = SDLK_q;
|
||||
|
||||
keycodes[i][K_UP].launcherkey = SDLK_UP;
|
||||
keycodes[i][K_DOWN].launcherkey = SDLK_DOWN;
|
||||
keycodes[i][K_LEFT].launcherkey = SDLK_LEFT;
|
||||
keycodes[i][K_RIGHT].launcherkey = SDLK_RIGHT;
|
||||
keycodes[i][K_RESET].launcherkey = SDLK_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// SDL
|
||||
DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags) { return 0xFFFFFFFF; }
|
||||
DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable) { return 1; }
|
||||
DECLSPEC int SDLCALL SDL_Init(Uint32 flags) { return 1; }
|
||||
DECLSPEC int SDLCALL SDL_ShowCursor(int toggle) { return 1; }
|
||||
DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode) { return SDL_GRAB_ON; }
|
||||
DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon) { return; }
|
||||
DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface) { return; }
|
||||
DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask) { return; }
|
||||
DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) { return NULL; }
|
||||
DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y) { return; }
|
||||
|
||||
DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event)
|
||||
{
|
||||
for (int i=0; i<MAX_KEYS; i++)
|
||||
{
|
||||
if (keycodes[0][i].state != keycodes[1][i].state)
|
||||
{
|
||||
keycodes[1][i].state = keycodes[0][i].state;
|
||||
if (keycodes[1][i].state == 1)
|
||||
event->type = event->key.type = SDL_KEYDOWN;
|
||||
else
|
||||
event->type = event->key.type = SDL_KEYUP;
|
||||
if (EventHandlerState == 0)
|
||||
event->key.keysym.sym = keycodes[0][i].sdlkey;
|
||||
else
|
||||
event->key.keysym.sym = keycodes[0][i].launcherkey;
|
||||
event->key.keysym.mod = (SDLMod) 0;
|
||||
event->key.keysym.unicode = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
event->type = SDL_NOEVENT;
|
||||
return 0;
|
||||
#include "bspf.hxx"
|
||||
#include "SDL.h"
|
||||
#include "gx.h"
|
||||
|
||||
char *msg = NULL;
|
||||
int EventHandlerState;
|
||||
|
||||
int time(int dummy)
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
||||
|
||||
char *getcwd(void)
|
||||
{
|
||||
TCHAR fileUnc[MAX_PATH+1];
|
||||
static char cwd[MAX_PATH+1] = "";
|
||||
char *plast;
|
||||
|
||||
GetModuleFileName(NULL, fileUnc, MAX_PATH);
|
||||
WideCharToMultiByte(CP_ACP, 0, fileUnc, -1, cwd, MAX_PATH, NULL, NULL);
|
||||
plast = strrchr(cwd, '\\');
|
||||
if(plast)
|
||||
*plast = 0;
|
||||
|
||||
return cwd;
|
||||
}
|
||||
|
||||
|
||||
struct key2event
|
||||
{
|
||||
UINT keycode;
|
||||
SDLKey sdlkey;
|
||||
uInt8 state;
|
||||
SDLKey launcherkey;
|
||||
};
|
||||
key2event keycodes[2][MAX_KEYS];
|
||||
|
||||
void KeySetup(void)
|
||||
{
|
||||
GXKeyList klist = GXGetDefaultKeys(GX_NORMALKEYS);
|
||||
|
||||
for (int i=0; i<2; i++)
|
||||
{
|
||||
for (int j=0; j<MAX_KEYS; j++, keycodes[i][j].state = 0,
|
||||
keycodes[i][j].launcherkey = SDLK_UNKNOWN);
|
||||
|
||||
keycodes[i][K_UP].keycode = klist.vkUp;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkDown;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkLeft;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkRight;
|
||||
keycodes[i][K_FIRE].keycode = klist.vkA;
|
||||
keycodes[i][K_RESET].keycode = klist.vkStart;
|
||||
keycodes[i][K_SELECT].keycode = klist.vkB;
|
||||
keycodes[i][K_QUIT].keycode = klist.vkC;
|
||||
|
||||
keycodes[i][K_UP].sdlkey = SDLK_UP;
|
||||
keycodes[i][K_DOWN].sdlkey = SDLK_DOWN;
|
||||
keycodes[i][K_LEFT].sdlkey = SDLK_LEFT;
|
||||
keycodes[i][K_RIGHT].sdlkey = SDLK_RIGHT;
|
||||
keycodes[i][K_FIRE].sdlkey = SDLK_SPACE;
|
||||
keycodes[i][K_RESET].sdlkey = SDLK_F2;
|
||||
keycodes[i][K_SELECT].sdlkey = SDLK_F1;
|
||||
keycodes[i][K_QUIT].sdlkey = SDLK_ESCAPE;
|
||||
|
||||
keycodes[i][K_UP].launcherkey = SDLK_UP;
|
||||
keycodes[i][K_DOWN].launcherkey = SDLK_DOWN;
|
||||
keycodes[i][K_LEFT].launcherkey = SDLK_PAGEUP;
|
||||
keycodes[i][K_RIGHT].launcherkey = SDLK_PAGEDOWN;
|
||||
keycodes[i][K_RESET].launcherkey = SDLK_RETURN;
|
||||
keycodes[i][K_QUIT].launcherkey = SDLK_ESCAPE;
|
||||
}
|
||||
}
|
||||
|
||||
void KeySetMode(int mode)
|
||||
{
|
||||
GXKeyList klist = GXGetDefaultKeys(GX_NORMALKEYS);
|
||||
|
||||
for (int i=0; i<2; i++)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
keycodes[i][K_UP].keycode = klist.vkUp;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkDown;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkLeft;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkRight;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
keycodes[i][K_UP].keycode = klist.vkRight;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkLeft;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkUp;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkDown;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
keycodes[i][K_UP].keycode = klist.vkLeft;
|
||||
keycodes[i][K_DOWN].keycode = klist.vkRight;
|
||||
keycodes[i][K_LEFT].keycode = klist.vkDown;
|
||||
keycodes[i][K_RIGHT].keycode = klist.vkUp;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SDL
|
||||
DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags) { return 0xFFFFFFFF; }
|
||||
DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable) { return 1; }
|
||||
DECLSPEC int SDLCALL SDL_Init(Uint32 flags) { return 1; }
|
||||
DECLSPEC int SDLCALL SDL_ShowCursor(int toggle) { return 1; }
|
||||
DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode) { return SDL_GRAB_ON; }
|
||||
DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon) { return; }
|
||||
DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface) { return; }
|
||||
DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask) { return; }
|
||||
DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask) { return NULL; }
|
||||
DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y) { return; }
|
||||
|
||||
DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event)
|
||||
{
|
||||
for (int i=0; i<MAX_KEYS; i++)
|
||||
{
|
||||
if (keycodes[0][i].state != keycodes[1][i].state)
|
||||
{
|
||||
keycodes[1][i].state = keycodes[0][i].state;
|
||||
if (i!=K_QUIT || EventHandlerState!=2)
|
||||
{
|
||||
if (keycodes[1][i].state == 1)
|
||||
event->type = event->key.type = SDL_KEYDOWN;
|
||||
else
|
||||
event->type = event->key.type = SDL_KEYUP;
|
||||
}
|
||||
else if (keycodes[1][i].state == 1)
|
||||
event->type = SDL_QUIT;
|
||||
if (EventHandlerState != 2)
|
||||
event->key.keysym.sym = keycodes[0][i].sdlkey;
|
||||
else
|
||||
event->key.keysym.sym = keycodes[0][i].launcherkey;
|
||||
event->key.keysym.mod = (SDLMod) 0;
|
||||
event->key.keysym.unicode = '\n'; // hack
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
event->type = SDL_NOEVENT;
|
||||
return 0;
|
||||
}
|
|
@ -1,25 +1,25 @@
|
|||
#ifndef _WCE_MISSING_H_
|
||||
#define _WCE_MISSING_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* WCE 300 does not support exception handling well */
|
||||
#define try if (1)
|
||||
#define catch(a) else if (0)
|
||||
extern char *msg;
|
||||
#define throw //
|
||||
|
||||
#pragma warning(disable: 4800)
|
||||
#pragma warning(disable: 4244)
|
||||
#pragma warning(disable: 4786)
|
||||
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
int time(int dummy);
|
||||
char *getcwd(void);
|
||||
|
||||
|
||||
#define MAX_KEYS 8
|
||||
enum key {K_UP = 0, K_DOWN, K_LEFT, K_RIGHT, K_FIRE, K_RESET, K_SELECT, K_QUIT};
|
||||
|
||||
#endif
|
||||
#ifndef _WCE_MISSING_H_
|
||||
#define _WCE_MISSING_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* WCE 300 does not support exception handling well */
|
||||
#define try if (1)
|
||||
#define catch(a) else if (0)
|
||||
extern char *msg;
|
||||
#define throw //
|
||||
|
||||
#pragma warning(disable: 4800)
|
||||
#pragma warning(disable: 4244)
|
||||
#pragma warning(disable: 4786)
|
||||
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
int time(int dummy);
|
||||
char *getcwd(void);
|
||||
|
||||
|
||||
#define MAX_KEYS 8
|
||||
enum key {K_UP = 0, K_DOWN, K_LEFT, K_RIGHT, K_FIRE, K_RESET, K_SELECT, K_QUIT};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resrc1.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
/*
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
*/
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resrc1.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""resource.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_STELLA ICON DISCARDABLE "stella.ico"
|
||||
//#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resource.rc
|
||||
//
|
||||
#define IDI_ICON1 102
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 104
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue