mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
************************************************************
* Merged Source Code from Development Trunk: Revision 4063 * ************************************************************ - Source Code is merged from: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP - This will be the Source for the Beta 2011 Test git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4064 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "TopicOps.h"
|
||||
#include "TopicIDs.h"
|
||||
|
||||
#include "VFS/vfs_types.h"
|
||||
#include <vfs/Core/vfs_types.h>
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
@@ -217,9 +217,73 @@ extern void _DebugMessage(const char *pSourceFile, unsigned uiLineNum, const cha
|
||||
#define DebugAttackBusy(x)
|
||||
#endif
|
||||
|
||||
#include "VFS/vfs_debug.h"
|
||||
#define SGP_CALLER_LOCATION , int line=0, const char* function=NULL, const char* file=NULL
|
||||
#define SGP_CALLER_LOCATION_IMPL , int line, const char* function, const char* file
|
||||
#define SGP_GET_CALLER_LOCATION , __LINE__, __FUNCTION__, __FILE__
|
||||
#define SGP_SET_CALLER_LOCATION , line, function, file
|
||||
|
||||
void _ExceptionMessage( CBasicException &ex );
|
||||
#include <stdexcept>
|
||||
#include <list>
|
||||
|
||||
namespace vfs { class Exception; }
|
||||
namespace sgp
|
||||
{
|
||||
class WString
|
||||
{
|
||||
public:
|
||||
WString(std::string const& s){
|
||||
convert_string(s,str);
|
||||
}
|
||||
WString(const char* s) {
|
||||
convert_string(s,str);
|
||||
}
|
||||
WString(std::wstring const& s) : str(s) {
|
||||
}
|
||||
WString(const wchar_t* s) : str(s) {
|
||||
}
|
||||
public:
|
||||
std::wstring str;
|
||||
};
|
||||
|
||||
class Exception : public std::exception
|
||||
{
|
||||
public:
|
||||
Exception(WString const& msg SGP_CALLER_LOCATION);
|
||||
|
||||
// default exception
|
||||
Exception(WString const& msg, Exception& ex SGP_CALLER_LOCATION);
|
||||
|
||||
// compatibility with std::exception
|
||||
Exception(WString const& msg, std::exception& ex SGP_CALLER_LOCATION);
|
||||
|
||||
#if defined(USE_VFS)
|
||||
// compatibility with vfs::Exception
|
||||
Exception(WString const& msg, vfs::Exception& ex SGP_CALLER_LOCATION);
|
||||
#endif
|
||||
|
||||
virtual const char* what() const throw();
|
||||
|
||||
struct Excp
|
||||
{
|
||||
int line;
|
||||
std::string function, file;
|
||||
std::wstring msg;
|
||||
};
|
||||
std::list<Excp> _msg;
|
||||
};
|
||||
}
|
||||
|
||||
#define SGP_THROW(msg) throw sgp::Exception( (msg) SGP_GET_CALLER_LOCATION )
|
||||
#define SGP_RETHROW(msg, ex) throw sgp::Exception( (msg), (ex) SGP_GET_CALLER_LOCATION )
|
||||
#define SGP_TRYCATCH_RETHROW(expr, msg) try { (expr); } catch(std::exception &ex) { throw sgp::Exception((msg), (ex) SGP_GET_CALLER_LOCATION); }
|
||||
|
||||
#define SGP_THROW_IFFALSE(cond, msg) if((cond) == false) { throw sgp::Exception(msg SGP_GET_CALLER_LOCATION); }
|
||||
#define SGP_THROW_IFNULL(ptr, msg) if((ptr) == NULL) { throw sgp::Exception(msg SGP_GET_CALLER_LOCATION); }
|
||||
|
||||
#include <vfs/Core/vfs_debug.h>
|
||||
|
||||
void _ExceptionMessage( sgp::Exception &ex );
|
||||
void _ExceptionMessage( vfs::Exception &ex );
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -48,9 +48,11 @@
|
||||
#ifndef _NO_DEBUG_TXT
|
||||
#include "fileman.h"
|
||||
#endif
|
||||
#include "GameSettings.h"
|
||||
#include "GameSettings.h"
|
||||
#include "SaveLoadGame.h"
|
||||
|
||||
#include "debug_util.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -402,7 +404,7 @@ void DbgShutdown() {};
|
||||
|
||||
extern HVOBJECT FontObjs[25];
|
||||
|
||||
|
||||
#include <vfs/Core/vfs_os_functions.h>
|
||||
void _FailMessage(const char* message, unsigned lineNum, const char * functionName, const char* sourceFileName)
|
||||
{
|
||||
// This function shouldn't recurse
|
||||
@@ -411,6 +413,8 @@ void _FailMessage(const char* message, unsigned lineNum, const char * functionNa
|
||||
return;
|
||||
alreadyInThisFunction = true;
|
||||
|
||||
sgp::dumpStackTrace(message);
|
||||
|
||||
std::stringstream basicInformation;
|
||||
basicInformation << "Assertion Failure [Line " << lineNum;
|
||||
if (functionName) {
|
||||
@@ -501,10 +505,26 @@ STR8 String(const STR8 String, ...)
|
||||
|
||||
}
|
||||
|
||||
void _ExceptionMessage( CBasicException &ex )
|
||||
void _ExceptionMessage( sgp::Exception &ex )
|
||||
{
|
||||
g_ExceptionList.clear();
|
||||
CBasicException::CALLSTACK::iterator it = ex.m_CallStack.begin();
|
||||
std::list<sgp::Exception::Excp>::iterator it = ex._msg.begin();
|
||||
for(; it!=ex._msg.end(); ++it)
|
||||
{
|
||||
SExceptionData exd;
|
||||
exd.message = (*it).msg;
|
||||
exd.function = (*it).function;
|
||||
exd.file = (*it).file;
|
||||
exd.line = (*it).line;
|
||||
g_ExceptionList.push_back(exd);
|
||||
}
|
||||
_FailMessage("",0,"");
|
||||
}
|
||||
|
||||
void _ExceptionMessage( vfs::Exception &ex )
|
||||
{
|
||||
g_ExceptionList.clear();
|
||||
vfs::Exception::CALLSTACK::iterator it = ex.m_CallStack.begin();
|
||||
for(; it!=ex.m_CallStack.end(); ++it)
|
||||
{
|
||||
SExceptionData exd;
|
||||
@@ -517,5 +537,127 @@ void _ExceptionMessage( CBasicException &ex )
|
||||
_FailMessage("",0,"");
|
||||
}
|
||||
|
||||
#include <vfs/Core/vfs_string.h>
|
||||
#include <vfs/Core/vfs_debug.h>
|
||||
|
||||
sgp::Exception::Exception(sgp::WString const& msg SGP_CALLER_LOCATION_IMPL)
|
||||
{
|
||||
Excp excp;
|
||||
excp.line = line;
|
||||
excp.file = file ? file : "";
|
||||
excp.function = function ? function : "";
|
||||
excp.msg = msg.str;
|
||||
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
|
||||
sgp::Exception::Exception(sgp::WString const& msg, Exception& ex SGP_CALLER_LOCATION_IMPL)
|
||||
{
|
||||
_msg.insert(_msg.end(), ex._msg.begin(), ex._msg.end());
|
||||
|
||||
Excp excp;
|
||||
excp.line = line;
|
||||
excp.file = file ? file : "";
|
||||
excp.function = function ? function : "";
|
||||
excp.msg = msg.str;
|
||||
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
|
||||
#if defined(USE_VFS)
|
||||
sgp::Exception::Exception(sgp::WString const& msg, vfs::Exception& ex SGP_CALLER_LOCATION_IMPL)
|
||||
{
|
||||
vfs::Exception::CALLSTACK::iterator it = ex.m_CallStack.begin();
|
||||
for(; it != ex.m_CallStack.end(); ++it)
|
||||
{
|
||||
Excp excp;
|
||||
excp.file = it->file.utf8();
|
||||
excp.function = it->function.utf8();
|
||||
excp.line = it->line;
|
||||
excp.msg = it->message.c_wcs();
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
|
||||
Excp excp;
|
||||
excp.line = line;
|
||||
excp.file = file ? file : "";
|
||||
excp.function = function ? function : "";
|
||||
excp.msg = msg.str;
|
||||
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
#endif
|
||||
|
||||
sgp::Exception::Exception(WString const& msg, std::exception& ex SGP_CALLER_LOCATION_IMPL)
|
||||
{
|
||||
if(dynamic_cast<sgp::Exception*>(&ex))
|
||||
{
|
||||
sgp::Exception& sgp_ex = *static_cast<sgp::Exception*>(&ex);
|
||||
_msg.insert(_msg.end(), sgp_ex._msg.begin(), sgp_ex._msg.end());
|
||||
}
|
||||
else if(dynamic_cast<vfs::Exception*>(&ex))
|
||||
{
|
||||
vfs::Exception& vfs_ex = *static_cast<vfs::Exception*>(&ex);
|
||||
vfs::Exception::CALLSTACK::iterator it = vfs_ex.m_CallStack.begin();
|
||||
for(; it != vfs_ex.m_CallStack.end(); ++it)
|
||||
{
|
||||
Excp excp;
|
||||
excp.file = it->file.utf8();
|
||||
excp.function = it->function.utf8();
|
||||
excp.line = it->line;
|
||||
excp.msg = it->message.c_wcs();
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Excp excp;
|
||||
excp.file = "";
|
||||
excp.function = "";
|
||||
excp.line = -1;
|
||||
convert_string(ex.what(), excp.msg);
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
|
||||
Excp excp;
|
||||
excp.line = line;
|
||||
excp.file = file ? file : "";
|
||||
excp.function = function ? function : "";
|
||||
excp.msg = msg.str;
|
||||
|
||||
_msg.push_back(excp);
|
||||
}
|
||||
|
||||
|
||||
#if defined(_WIN32) || defined(WIN64)
|
||||
# define ENDL "\r\n"
|
||||
#else
|
||||
# define ENDL "\n"
|
||||
#endif
|
||||
|
||||
static std::string gs_exception_string;
|
||||
|
||||
const char* sgp::Exception::what() const
|
||||
{
|
||||
// cannot return pointer local variable
|
||||
std::stringstream ss;
|
||||
ss.str("");
|
||||
ss.clear();
|
||||
|
||||
std::list<Excp>::const_reverse_iterator rit = _msg.rbegin();
|
||||
for(; rit != _msg.rend(); ++rit)
|
||||
{
|
||||
std::string msg;
|
||||
convert_string(rit->msg, msg);
|
||||
//wss << "========== " << rit->time << " =========="ENDL;
|
||||
ss << "File : " << rit->file << ENDL;
|
||||
ss << "Line : " << rit->line << ENDL;
|
||||
ss << "Location : " << rit->function << ENDL;
|
||||
ss << " " << msg << ENDL;
|
||||
}
|
||||
|
||||
gs_exception_string = ss.str();
|
||||
return gs_exception_string.c_str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,18 +45,18 @@
|
||||
#include "Container.h"
|
||||
#include "LibraryDataBase.h"
|
||||
#include "io.h"
|
||||
|
||||
#include "sgp_logger.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/os_functions.h"
|
||||
#include "VFS/vfs_settings.h"
|
||||
#include <vfs/Core/vfs.h>
|
||||
#include <vfs/Core/vfs_os_functions.h>
|
||||
#include <vfs/Aspects/vfs_settings.h>
|
||||
|
||||
#ifdef USE_VFS
|
||||
|
||||
#include "VFS/vfs_file_raii.h"
|
||||
#include <vfs/Core/vfs_file_raii.h>
|
||||
#include <map>
|
||||
|
||||
struct SOperation
|
||||
@@ -410,10 +410,10 @@ HWFILE FileOpen( STR strFilename, UINT32 uiOptions, BOOLEAN fDeleteOnClose )
|
||||
// sometimes a file is supposed to opened that does not exist (not tested with FileExists())
|
||||
// this operation can fail with an exception that the calling code doesn't catch
|
||||
// instead we catch it (any exception, not just CBasicException) here and return 0
|
||||
catch(CBasicException& ex) { logException(ex); }
|
||||
catch(vfs::Exception& ex) { SGP_ERROR(ex.what()); }
|
||||
catch(...)
|
||||
{
|
||||
logException( CBasicException("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__) );
|
||||
SGP_ERROR( "Caught undefined exception" );
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
@@ -680,25 +680,25 @@ BOOLEAN FileRead( HWFILE hFile, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiByte
|
||||
vfs::tReadableFile *pRF = vfs::tReadableFile::cast(pFile);
|
||||
if(pRF)
|
||||
{
|
||||
UINT32 uiBytesRead;
|
||||
UINT32 uiBytesRead = 0;
|
||||
try
|
||||
{
|
||||
uiBytesRead = pRF->read((vfs::Byte*)pDest, uiBytesToRead);
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(std::exception& ex)
|
||||
{
|
||||
pRF->close();
|
||||
RETHROWEXCEPTION(L"", &ex);
|
||||
SGP_RETHROW(L"", ex);
|
||||
}
|
||||
|
||||
if(uiBytesToRead != uiBytesRead)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(puiBytesRead)
|
||||
{
|
||||
*puiBytesRead = uiBytesRead;
|
||||
}
|
||||
if(uiBytesToRead != uiBytesRead)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -820,10 +820,10 @@ BOOLEAN FileWrite( HWFILE hFile, PTR pDest, UINT32 uiBytesToWrite, UINT32 *puiBy
|
||||
{
|
||||
uiBytesWritten = pWF->write((vfs::Byte*)pDest, uiBytesToWrite);
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(std::exception& ex)
|
||||
{
|
||||
pWF->close();
|
||||
RETHROWEXCEPTION(L"", &ex);
|
||||
SGP_RETHROW(L"", ex);
|
||||
}
|
||||
|
||||
if (uiBytesToWrite != uiBytesWritten)
|
||||
@@ -905,7 +905,7 @@ BOOLEAN FileLoad( STR strFilename, PTR pDest, UINT32 uiBytesToRead, UINT32 *puiB
|
||||
if(pFile)
|
||||
{
|
||||
UINT32 uiNumBytesRead;
|
||||
TRYCATCH_RETHROW(uiNumBytesRead = pFile->read((vfs::Byte*)pDest,uiBytesToRead), L"");
|
||||
SGP_TRYCATCH_RETHROW(uiNumBytesRead = pFile->read((vfs::Byte*)pDest,uiBytesToRead), L"");
|
||||
|
||||
if (uiBytesToRead != uiNumBytesRead)
|
||||
{
|
||||
@@ -1073,7 +1073,7 @@ BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow )
|
||||
vfs::tWritableFile *pWF = vfs::tWritableFile::cast(pFile);
|
||||
if(pWF)
|
||||
{
|
||||
TRYCATCH_RETHROW(pWF->setWritePosition(iDistance, eSD), L"");
|
||||
SGP_TRYCATCH_RETHROW(pWF->setWritePosition(iDistance, eSD), L"");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1082,13 +1082,13 @@ BOOLEAN FileSeek( HWFILE hFile, UINT32 uiDistance, UINT8 uiHow )
|
||||
vfs::tReadableFile *pRF = vfs::tReadableFile::cast(pFile);
|
||||
if(pRF)
|
||||
{
|
||||
TRYCATCH_RETHROW(pRF->setReadPosition(iDistance, eSD), L"");
|
||||
SGP_TRYCATCH_RETHROW(pRF->setReadPosition(iDistance, eSD), L"");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
THROWEXCEPTION(L"unknown operation");
|
||||
SGP_THROW(L"unknown operation");
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
@@ -1604,11 +1604,11 @@ BOOLEAN SetFileManCurrentDirectory( STR pcDirectory )
|
||||
#else
|
||||
try
|
||||
{
|
||||
os::setCurrectDirectory(pcDirectory);
|
||||
vfs::OS::setCurrectDirectory(pcDirectory);
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(vfs::Exception& ex)
|
||||
{
|
||||
logException(ex);
|
||||
SGP_ERROR(ex.what());
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@@ -1628,12 +1628,12 @@ BOOLEAN GetFileManCurrentDirectory( STRING512 pcDirectory )
|
||||
try
|
||||
{
|
||||
vfs::Path sDir;
|
||||
os::getCurrentDirectory(sDir);
|
||||
vfs::OS::getCurrentDirectory(sDir);
|
||||
strncpy(pcDirectory, sDir.to_string().c_str(), 512);
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(vfs::Exception& ex)
|
||||
{
|
||||
logException(ex);
|
||||
SGP_ERROR(ex.what());
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@@ -1841,7 +1841,7 @@ BOOLEAN GetExecutableDirectory( STRING512 pcDirectory )
|
||||
{
|
||||
#ifdef USE_VFS
|
||||
vfs::Path exe_dir, exe_file;
|
||||
os::getExecutablePath(exe_dir, exe_file);
|
||||
vfs::OS::getExecutablePath(exe_dir, exe_file);
|
||||
strncpy(pcDirectory, exe_dir.to_string().c_str(), 512);
|
||||
return true;
|
||||
#else
|
||||
@@ -2215,7 +2215,7 @@ BOOLEAN FileCheckEndOfFile( HWFILE hFile )
|
||||
{
|
||||
current_position = pWF->getWritePosition();
|
||||
max_position = pWF->getSize();
|
||||
return current_position < max_position;
|
||||
return current_position >= max_position;
|
||||
}
|
||||
}
|
||||
else if(pFile && (s_mapFiles[pFile].op == SOperation::READ))
|
||||
@@ -2225,7 +2225,7 @@ BOOLEAN FileCheckEndOfFile( HWFILE hFile )
|
||||
{
|
||||
current_position = pRF->getReadPosition();
|
||||
max_position = pRF->getSize();
|
||||
return current_position < max_position;
|
||||
return current_position >= max_position;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
@@ -132,7 +132,7 @@ UINT32 uiRed, uiGreen, uiBlue;
|
||||
//return;
|
||||
std::wstringstream wss;
|
||||
wss << L"invalid font index ( " << FontDefault << L" )";
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
SGP_THROW(wss.str().c_str());
|
||||
}
|
||||
|
||||
FontForeground8=ubForeground;
|
||||
@@ -197,7 +197,7 @@ UINT32 uiRed, uiGreen, uiBlue;
|
||||
//return;
|
||||
std::wstringstream wss;
|
||||
wss << L"invalid color background value ( " << ubBackground << L" )";
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
SGP_THROW(wss.str().c_str());
|
||||
}
|
||||
|
||||
FontBackground8=ubBackground;
|
||||
@@ -942,9 +942,9 @@ BOOLEAN SetFont(INT32 iFontIndex)
|
||||
//Assert(iFontIndex >= 0);
|
||||
//Assert(iFontIndex <= MAX_FONTS);
|
||||
//Assert(FontObjs[iFontIndex]!=NULL);
|
||||
THROWIFFALSE( iFontIndex >= 0 ,"negative font index");
|
||||
THROWIFFALSE( iFontIndex <= MAX_FONTS, "font index > MAX_FONTS" );
|
||||
THROWIFFALSE( FontObjs[iFontIndex]!=NULL, "font is not initialized" );
|
||||
SGP_THROW_IFFALSE( iFontIndex >= 0 ,"negative font index");
|
||||
SGP_THROW_IFFALSE( iFontIndex <= MAX_FONTS, "font index > MAX_FONTS" );
|
||||
SGP_THROW_IFFALSE( FontObjs[iFontIndex]!=NULL, "font is not initialized" );
|
||||
#ifdef WINFONTS
|
||||
SET_WINFONT(WinFontMap[iFontIndex]);
|
||||
#endif
|
||||
|
||||
@@ -31,13 +31,12 @@
|
||||
#include "MemMan.h"
|
||||
#include "Debug.h"
|
||||
#include <stdio.h>
|
||||
#include "sgp_logger.h"
|
||||
#ifdef _DEBUG
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/Tools/Log.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
//#define DEBUG_MEM_LEAKS // turns on tracking of every MemAlloc and MemFree!
|
||||
@@ -231,16 +230,17 @@ void ShutdownMemoryManager( void )
|
||||
}
|
||||
fclose( fp );
|
||||
#else
|
||||
CLog memLeak( L"MemLeakInfo.txt", true);
|
||||
memLeak.endl().endl();
|
||||
memLeak << ">>>>> MEMORY LEAK DETECTED!!! <<<<<" << CLog::ENDL;
|
||||
memLeak << " " << guiMemAlloced << " bytes memory total was allocated" << CLog::ENDL;
|
||||
memLeak << "- " << guiMemFreed << " bytes memory total was freed" << CLog::ENDL;
|
||||
memLeak << "_______________________________________________" << CLog::ENDL;
|
||||
memLeak << guiMemTotal << " bytes memory total STILL allocated" << CLog::ENDL;
|
||||
memLeak << MemDebugCounter << " memory blocks still allocated" << CLog::ENDL;
|
||||
memLeak << "guiScreenExitedFrom = " << gzJA2ScreenNames[ gMsgBox.uiExitScreen ] << CLog::ENDL;
|
||||
memLeak.endl().endl();
|
||||
sgp::Logger_ID log_id = sgp::Logger::instance().createLogger();
|
||||
sgp::Logger::LogInstance memLeak = SGP_LOG(log_id);
|
||||
memLeak << sgp::endl << sgp::endl;
|
||||
memLeak << ">>>>> MEMORY LEAK DETECTED!!! <<<<<" << sgp::endl;
|
||||
memLeak << " " << guiMemAlloced << " bytes memory total was allocated" << sgp::endl;
|
||||
memLeak << "- " << guiMemFreed << " bytes memory total was freed" << sgp::endl;
|
||||
memLeak << "_______________________________________________" << sgp::endl;
|
||||
memLeak << guiMemTotal << " bytes memory total STILL allocated" << sgp::endl;
|
||||
memLeak << MemDebugCounter << " memory blocks still allocated" << sgp::endl;
|
||||
memLeak << "guiScreenExitedFrom = " << gzJA2ScreenNames[ gMsgBox.uiExitScreen ] << sgp::endl;
|
||||
memLeak << sgp::endl << sgp::endl;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3,21 +3,25 @@
|
||||
#include "DEBUG.H"
|
||||
#include "vobject.h"
|
||||
#include "STIConvert.h"
|
||||
#include "MemMan.h"
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_file_raii.h"
|
||||
#include "VFS/Location/vfs_7z_library.h"
|
||||
#include "VFS/Interface/vfs_location_interface.h"
|
||||
#include "VFS/File/vfs_memory_file.h"
|
||||
#include <vfs/Core/vfs.h>
|
||||
#include <vfs/Core/vfs_file_raii.h>
|
||||
#include <vfs/Ext/7z/vfs_7z_library.h>
|
||||
#include <vfs/Core/Interface/vfs_location_interface.h>
|
||||
#include <vfs/Core/File/vfs_buffer_file.h>
|
||||
#include <vfs/Core/File/vfs_lib_file.h>
|
||||
|
||||
#include "XML_Parser.h"
|
||||
namespace png
|
||||
{
|
||||
#include <png.h>
|
||||
# include <png.h>
|
||||
}
|
||||
|
||||
const utf8string::str_t CONST_DOTPNG(L".png");
|
||||
const utf8string::str_t CONST_DOTXML(L".xml");
|
||||
#include "sgp_auto_memory.h"
|
||||
|
||||
const vfs::String::str_t CONST_DOTPNG(L".png");
|
||||
const vfs::String::str_t CONST_DOTXML(L".xml");
|
||||
|
||||
void Load24bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info);
|
||||
void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info);
|
||||
@@ -26,7 +30,7 @@ void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop in
|
||||
|
||||
void user_read_data(png::png_structp png_ptr, png::png_bytep data, png::png_size_t length)
|
||||
{
|
||||
TRYCATCH_RETHROW( static_cast<vfs::tReadableFile*>(png_ptr->io_ptr)->read((vfs::Byte*)data,length),
|
||||
SGP_TRYCATCH_RETHROW( static_cast<vfs::tReadableFile*>(png_ptr->io_ptr)->read((vfs::Byte*)data,length),
|
||||
L"error during png file reading");
|
||||
}
|
||||
|
||||
@@ -160,7 +164,7 @@ bool IndexedSTIImage::addImage(UINT8 *data, UINT32 data_size, UINT32 image_width
|
||||
subimage.usHeight = image_height;
|
||||
|
||||
INT32 etrle_size = ETRLECompressSubImage( compressed, RESIZE, data, image_width, image_height, &subimage);
|
||||
THROWIFFALSE( etrle_size > 0, L"not enough space reserved for ETRLE compression");
|
||||
SGP_THROW_IFFALSE( etrle_size > 0, L"not enough space reserved for ETRLE compression");
|
||||
subimage.sOffsetX = image_offset_x;
|
||||
subimage.sOffsetY = image_offset_y;
|
||||
|
||||
@@ -247,8 +251,8 @@ static inline void setFlag(UINT8 &flags, char const* sFlag)
|
||||
else
|
||||
{
|
||||
std::wstringstream wss;
|
||||
wss << L"Unknown flag [" << utf8string::as_utf16(sFlag) << L"]";
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
wss << L"Unknown flag [" << vfs::String::as_utf16(sFlag) << L"]";
|
||||
SGP_THROW(wss.str().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +270,7 @@ class CAppDataParser : public IXMLParser
|
||||
};
|
||||
public:
|
||||
CAppDataParser(XML_Parser &parser, IXMLParser* caller=NULL)
|
||||
: IXMLParser("ImageData", parser, caller),
|
||||
: IXMLParser("ImageData", &parser, caller),
|
||||
current_state(DO_ELEMENT_NONE),
|
||||
m_hImage(NULL),
|
||||
m_iCurrentIndex(-1)
|
||||
@@ -316,7 +320,7 @@ void CAppDataParser::onStartElement(const XML_Char* name, const XML_Char** atts)
|
||||
else if(current_state == DO_ELEMENT_ImageData && strcmp(name, "SubImage") == 0)
|
||||
{
|
||||
int index = -1;
|
||||
THROWIFFALSE(getAttributeAsInt("index",atts,index), L"could not read attribute \"index\"");
|
||||
SGP_THROW_IFFALSE(getAttributeAsInt("index",atts,index), L"could not read attribute \"index\"");
|
||||
m_iCurrentIndex = index;
|
||||
if(index >= (int)m_vAppData.size())
|
||||
{
|
||||
@@ -414,7 +418,7 @@ void CAppDataParser::onEndElement(const XML_Char* name)
|
||||
{
|
||||
sum_frames += m_vAppData[i].aux.ubNumberOfFrames;
|
||||
}
|
||||
THROWIFFALSE(sum_frames <= m_vAppData.size(), L"Sum of animation frames doesn't match the total number of frames");
|
||||
SGP_THROW_IFFALSE(sum_frames <= m_vAppData.size(), L"Sum of animation frames doesn't match the total number of frames");
|
||||
int iAppDataSize = m_vAppData.size()*sizeof(AuxObjectData);
|
||||
m_hImage->pAppData = (UINT8*) MemAlloc( iAppDataSize );
|
||||
for(unsigned int i = 0; i < m_vAppData.size(); ++i)
|
||||
@@ -431,6 +435,7 @@ void CAppDataParser::onEndElement(const XML_Char* name)
|
||||
m_hImage->pETRLEObject[i].sOffsetY = m_vAppData[i].offset.y;
|
||||
}
|
||||
}
|
||||
m_hImage->fFlags |= IMAGE_APPDATA;
|
||||
current_state = DO_ELEMENT_NONE;
|
||||
}
|
||||
}
|
||||
@@ -456,16 +461,16 @@ bool IndexedSTIImage::readAppDataFromXMLFile(HIMAGE hImage, vfs::tReadableFile*
|
||||
try
|
||||
{
|
||||
vfs::COpenReadFile oFile(pFile);
|
||||
uiSize = oFile.file().getSize();
|
||||
uiSize = oFile->getSize();
|
||||
vBuffer.resize(uiSize+1);
|
||||
|
||||
THROWIFFALSE(uiSize == oFile.file().read(&vBuffer[0],uiSize), L"Could not read XML file");
|
||||
SGP_THROW_IFFALSE(uiSize == oFile->read(&vBuffer[0],uiSize), L"Could not read XML file");
|
||||
vBuffer[uiSize] = 0;
|
||||
oFile.file().close();
|
||||
oFile->close();
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(std::exception& ex)
|
||||
{
|
||||
RETHROWEXCEPTION(L"", &ex);
|
||||
SGP_RETHROW(L"", ex);
|
||||
}
|
||||
|
||||
XML_Parser parser = XML_ParserCreate(NULL);
|
||||
@@ -480,15 +485,15 @@ bool IndexedSTIImage::readAppDataFromXMLFile(HIMAGE hImage, vfs::tReadableFile*
|
||||
{
|
||||
std::wstringstream wss;
|
||||
wss << L"XML Parser Error in Groups.xml: "
|
||||
<< utf8string(XML_ErrorString(XML_GetErrorCode(parser))).c_wcs()
|
||||
<< vfs::String(XML_ErrorString(XML_GetErrorCode(parser))).c_wcs()
|
||||
<< L" at line "
|
||||
<< XML_GetCurrentLineNumber(parser);
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
SGP_THROW(wss.str().c_str());
|
||||
}
|
||||
}
|
||||
catch(CBasicException &ex)
|
||||
catch(std::exception &ex)
|
||||
{
|
||||
RETHROWEXCEPTION(L"Could not load xml file", &ex);
|
||||
SGP_RETHROW(L"Could not load xml file", ex);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -581,7 +586,7 @@ public:
|
||||
LoadPngFile(vfs::tReadableFile* pFile)
|
||||
: _file(pFile), _struct(NULL), _info(NULL), _row_ptr(NULL)
|
||||
{
|
||||
THROWIFFALSE(_file, L"file pointer is NULL");
|
||||
SGP_THROW_IFFALSE(_file, L"file pointer is NULL");
|
||||
}
|
||||
bool Load()
|
||||
{
|
||||
@@ -683,7 +688,7 @@ bool LoadPNGFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
std::wstringstream wss;
|
||||
wss << L"Unknown image datatype : channels = " << (int)(fpng.Info()->channels)
|
||||
<< L", bit depth = " << (int)(fpng.Info()->bit_depth);
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
SGP_THROW(wss.str().c_str());
|
||||
}
|
||||
|
||||
// data was copied to hImage, need to clean up here
|
||||
@@ -698,14 +703,14 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
vfs::CMemoryFile oBuffer("");
|
||||
vfs::CBufferFile oBuffer("");
|
||||
|
||||
vfs::COpenReadFile oFile(hImage->ImageFile);
|
||||
TRYCATCH_RETHROW(oBuffer.copyToBuffer(oFile.file()), L"Could not copy file to buffer");
|
||||
SGP_TRYCATCH_RETHROW(oBuffer.copyToBuffer(oFile.file()), L"Could not copy file to buffer");
|
||||
oBuffer.close();
|
||||
|
||||
//vfs::CUncompressed7zLibrary oLib(&oFile.file(),"");
|
||||
ObjBlockAllocator<vfs::CLibFile> allocator(128);
|
||||
vfs::ObjBlockAllocator<vfs::CLibFile> allocator(128);
|
||||
vfs::CUncompressed7zLibrary oLib(vfs::tReadableFile::cast(&oBuffer),"",false, &allocator);
|
||||
|
||||
if(!oLib.init())
|
||||
@@ -728,11 +733,11 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
for(; !it.end(); it.next())
|
||||
{
|
||||
// check extension
|
||||
utf8string::str_t const& fname = it.value()->getName().c_wcs();
|
||||
utf8string::size_t dot = fname.find_last_of(vfs::Const::DOT());
|
||||
if(dot != utf8string::str_t::npos)
|
||||
vfs::String::str_t const& fname = it.value()->getName().c_wcs();
|
||||
vfs::String::size_t dot = fname.find_last_of(vfs::Const::DOT());
|
||||
if(dot != vfs::String::str_t::npos)
|
||||
{
|
||||
if( StrCmp::Equal(fname.substr(dot,fname.length()-dot), CONST_DOTPNG) )
|
||||
if( vfs::StrCmp::Equal(fname.substr(dot,fname.length()-dot), CONST_DOTPNG) )
|
||||
{
|
||||
std::wstringstream bss;
|
||||
bss.str( fname.substr(0,dot) );
|
||||
@@ -744,10 +749,10 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
}
|
||||
else
|
||||
{
|
||||
THROWEXCEPTION(L"invalid index");
|
||||
SGP_THROW(L"invalid index");
|
||||
}
|
||||
}
|
||||
else if (StrCmp::Equal(fname.substr(dot,fname.length()-dot), CONST_DOTXML) )
|
||||
else if (vfs::StrCmp::Equal(fname.substr(dot,fname.length()-dot), CONST_DOTXML) )
|
||||
{
|
||||
appdata_file = vfs::tReadableFile::cast(it.value());
|
||||
}
|
||||
@@ -783,18 +788,18 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
std::wstringstream wss;
|
||||
wss << L"Unknown image datatype : channels = " << (int)(lpng.Info()->channels)
|
||||
<< L", bit depth = " << (int)(lpng.Info()->bit_depth);
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
SGP_THROW(wss.str().c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch(CBasicException &ex)
|
||||
catch(std::exception &ex)
|
||||
{
|
||||
std::wstringstream wss;
|
||||
wss << L"Loading PNG image from file '"
|
||||
<< oFile.file().getPath().c_wcs()
|
||||
<< oFile->getPath().c_wcs()
|
||||
<< L"' failed";
|
||||
RETHROWEXCEPTION(wss.str().c_str(),&ex);
|
||||
SGP_RETHROW(wss.str().c_str(), ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -809,7 +814,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
}
|
||||
try
|
||||
{
|
||||
vfs::CMemoryFile oTempFile("");
|
||||
vfs::CBufferFile oTempFile("");
|
||||
oTempFile.copyToBuffer( *vfs::tReadableFile::cast(*fit) );
|
||||
|
||||
// LoadPngFile lpng( vfs::tReadableFile::cast(*fit) );
|
||||
@@ -822,7 +827,7 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
{
|
||||
if(!bHasPalette)
|
||||
{
|
||||
THROWIFFALSE(lpng.Info()->num_palette == 256, L"size of palette is not 256");
|
||||
SGP_THROW_IFFALSE(lpng.Info()->num_palette == 256, L"size of palette is not 256");
|
||||
image.setPalette(lpng.Info()->palette, lpng.Info()->num_palette);
|
||||
bHasPalette = true;
|
||||
}
|
||||
@@ -837,16 +842,16 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
else
|
||||
{
|
||||
std::wstringstream wss;
|
||||
wss << L"PNG file '" << (*fit)->getName()() << L" @ " << oFile.file().getPath()() << L"' is not a paletted image";
|
||||
THROWEXCEPTION(wss.str().c_str());
|
||||
wss << L"PNG file '" << (*fit)->getName()() << L" @ " << oFile->getPath()() << L"' is not a paletted image";
|
||||
SGP_THROW(wss.str().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(std::exception& ex)
|
||||
{
|
||||
std::wstringstream wss;
|
||||
wss << L"Loading PNG image [" << findex << L"] from file '" << oFile.file().getPath().c_wcs() << L"' failed";
|
||||
RETHROWEXCEPTION(wss.str().c_str(),&ex);
|
||||
wss << L"Loading PNG image [" << findex << L"] from file '" << oFile->getPath().c_wcs() << L"' failed";
|
||||
SGP_RETHROW(wss.str().c_str(), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -861,14 +866,34 @@ bool LoadJPCFileToImage(HIMAGE hImage, UINT16 fContents)
|
||||
|
||||
void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
|
||||
{
|
||||
#if 1
|
||||
hImage->pETRLEObject = (ETRLEObject*)MemAlloc(1 * sizeof(ETRLEObject));
|
||||
if(!hImage->pETRLEObject)
|
||||
{
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memset(hImage->pETRLEObject, 0, sizeof(ETRLEObject));
|
||||
hImage->usNumberOfObjects = 1;
|
||||
|
||||
hImage->pETRLEObject[0].usHeight = (UINT16)info->height;
|
||||
hImage->pETRLEObject[0].usWidth = (UINT16)info->width;
|
||||
|
||||
hImage->pETRLEObject[0].sOffsetX = (INT16)info->x_offset;
|
||||
hImage->pETRLEObject[0].sOffsetY = (INT16)info->y_offset;
|
||||
|
||||
hImage->usHeight = (UINT16)info->height;
|
||||
hImage->usWidth = (UINT16)info->width;
|
||||
hImage->ubBitDepth = 32;
|
||||
|
||||
UINT32 SIZE = info->height * info->width * sizeof(UINT32);
|
||||
hImage->p32BPPData = (UINT32*)MemAlloc(SIZE);
|
||||
if(!hImage->p32BPPData)
|
||||
{
|
||||
MemFree(hImage->pETRLEObject);
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memset(hImage->p32BPPData, 0, SIZE);
|
||||
|
||||
#if 1
|
||||
UINT32 SIZE = info->height * info->width;
|
||||
hImage->p32BPPData = new UINT32[SIZE];
|
||||
memset(hImage->p32BPPData, 0, SIZE*sizeof(UINT32));
|
||||
UINT32* dest_row = NULL;
|
||||
UINT32 rgbcolor = 0;
|
||||
for(unsigned int i=0; i<info->height; ++i)
|
||||
@@ -877,6 +902,8 @@ void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
|
||||
png::png_bytep row_i = rows[i];
|
||||
memcpy(dest_row,row_i,info->width * sizeof(UINT32));
|
||||
}
|
||||
|
||||
hImage->fFlags |= IMAGE_BITMAPDATA;
|
||||
#else
|
||||
UINT32 SIZE = info->height * info->width;
|
||||
hImage->p16BPPData = new UINT16[SIZE];
|
||||
@@ -913,13 +940,32 @@ void Load32bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
|
||||
|
||||
void Load24bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
|
||||
{
|
||||
hImage->pETRLEObject = (ETRLEObject*)MemAlloc(1 * sizeof(ETRLEObject));
|
||||
if(!hImage->pETRLEObject)
|
||||
{
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memset(hImage->pETRLEObject, 0, sizeof(ETRLEObject));
|
||||
hImage->usNumberOfObjects = 1;
|
||||
|
||||
hImage->pETRLEObject[0].usHeight = (UINT16)info->height;
|
||||
hImage->pETRLEObject[0].usWidth = (UINT16)info->width;
|
||||
|
||||
hImage->pETRLEObject[0].sOffsetX = (UINT16)info->x_offset;
|
||||
hImage->pETRLEObject[0].sOffsetY = (UINT16)info->y_offset;
|
||||
|
||||
hImage->usHeight = (UINT16)info->height;
|
||||
hImage->usWidth = (UINT16)info->width;
|
||||
hImage->ubBitDepth = 16;
|
||||
|
||||
UINT32 SIZE = info->height * info->width;
|
||||
hImage->p16BPPData = new UINT16[SIZE];
|
||||
memset(hImage->p16BPPData, 0, SIZE*sizeof(UINT16));
|
||||
UINT32 SIZE = info->height * info->width * sizeof(UINT16);
|
||||
hImage->p16BPPData = (UINT16*)MemAlloc(SIZE);
|
||||
if(!hImage->p16BPPData)
|
||||
{
|
||||
MemFree(hImage->pETRLEObject);
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memset(hImage->p16BPPData, 0, SIZE);
|
||||
|
||||
UINT16* dest_row = NULL;
|
||||
UINT32 rgbcolor = 0;
|
||||
@@ -932,12 +978,17 @@ void Load24bppPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
|
||||
dest_row[dx] = Get16BPPColor( FROMRGB(row_i[sx], row_i[sx+1], row_i[sx+2]) );
|
||||
}
|
||||
}
|
||||
hImage->fFlags |= IMAGE_BITMAPDATA;
|
||||
}
|
||||
|
||||
void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop info)
|
||||
{
|
||||
UINT32 SIZE = info->height * info->width;
|
||||
UINT8 *data = new UINT8[SIZE];
|
||||
UINT32 SIZE = info->height * info->width * sizeof(UINT8);
|
||||
UINT8 *data = (UINT8*)MemAlloc(SIZE);
|
||||
if(!data)
|
||||
{
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memset(data,0,SIZE);
|
||||
for(unsigned int i = 0; i < info->height; ++i)
|
||||
{
|
||||
@@ -945,7 +996,12 @@ void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop in
|
||||
}
|
||||
|
||||
hImage->usNumberOfObjects = 1;
|
||||
hImage->pETRLEObject = new ETRLEObject[hImage->usNumberOfObjects];
|
||||
hImage->pETRLEObject = (ETRLEObject*)MemAlloc(hImage->usNumberOfObjects * sizeof(ETRLEObject));
|
||||
if(!hImage->pETRLEObject)
|
||||
{
|
||||
MemFree(data);
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memset(hImage->pETRLEObject,0, hImage->usNumberOfObjects * sizeof(ETRLEObject));
|
||||
|
||||
ETRLEObject &subimage = hImage->pETRLEObject[0];
|
||||
@@ -956,7 +1012,13 @@ void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop in
|
||||
|
||||
// why allocate so much? because in in the worst case we need one TAG and one DATAVALUE per pixel
|
||||
UINT32 RESIZE = 3*SIZE;
|
||||
hImage->p8BPPData = new UINT8[RESIZE];
|
||||
hImage->p8BPPData = (UINT8*)MemAlloc( RESIZE );
|
||||
if(!hImage->p8BPPData)
|
||||
{
|
||||
MemFree(hImage->pETRLEObject);
|
||||
MemFree(data);
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
UINT8 *compressed = hImage->p8BPPData;
|
||||
memset(hImage->p8BPPData,0,RESIZE);
|
||||
UINT32 compressed_size = 0;
|
||||
@@ -970,7 +1032,7 @@ void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop in
|
||||
subim.usWidth = subimage.usWidth;
|
||||
|
||||
UINT32 etrle_size = ETRLECompressSubImage( hImage->p8BPPData, RESIZE, data, (UINT16)info->width, (UINT16)info->height, &subim);
|
||||
THROWIFFALSE( etrle_size > 0, L"ETRLE compression of PNG image failed" );
|
||||
SGP_THROW_IFFALSE( etrle_size > 0, L"ETRLE compression of PNG image failed" );
|
||||
subim.sOffsetX = subimage.sOffsetX;
|
||||
subim.sOffsetY = subimage.sOffsetY;
|
||||
#if 0
|
||||
@@ -1047,9 +1109,9 @@ void LoadPalettedPNGImage(HIMAGE hImage, png::png_bytepp rows, png::png_infop in
|
||||
hImage->fFlags |= IMAGE_BITMAPDATA;
|
||||
|
||||
// palette
|
||||
THROWIFFALSE(info->num_palette == 256, L"palette has size != 256");
|
||||
SGP_THROW_IFFALSE(info->num_palette == 256, L"palette has size != 256");
|
||||
|
||||
hImage->pPalette = new SGPPaletteEntry[256];
|
||||
hImage->pPalette = (SGPPaletteEntry*)MemAlloc(sizeof(SGPPaletteEntry) *256);
|
||||
for(int i=0; i<256; ++i)
|
||||
{
|
||||
hImage->pPalette[i].peRed = info->palette[i].red;
|
||||
|
||||
@@ -0,0 +1,803 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="SGP"
|
||||
ProjectGUID="{6283CE93-2960-4596-8E74-7A6FBA8716FF}"
|
||||
RootNamespace="SGP"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="..\lib\VS2005\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2005\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2.vsprops;..\ja2_Debug.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="..\lib\VS2005\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2005\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="MapEditor|Win32"
|
||||
OutputDirectory="..\lib\VS2005\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2005\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2.vsprops;..\ja2_Editor.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="MapEditorD|Win32"
|
||||
OutputDirectory="..\lib\VS2005\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2005\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2.vsprops;..\ja2_Editor.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release_WithDebugInfo|Win32"
|
||||
OutputDirectory="..\lib\VS2005\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2005\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Bitmap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Button Sound Control.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Button System.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Compression.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Container.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Cursor Control.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DbMan.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ddraw.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DEBUG.H"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\debug_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DirectDraw Calls.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DirectX Common.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\dsound.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\english.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ExceptionHandling.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\expat.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileCat.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileMan.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\flic.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\fmod.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\fmod_errors.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Font.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\himage.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\imgfmt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\impTGA.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\input.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Install.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Ja2 Libs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\JA2 SGP ALL.H"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LibraryDataBase.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\line.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MemMan.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mousesystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mousesystem_macros.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Mss-old.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Mss.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Mutex Manager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pcx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PngLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RAD.H"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\radbase.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\random.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\readdir.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RegInst.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sgp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sgp_auto_memory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sgp_logger.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\shading.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\SMACK.H"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\soundman.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\STCI.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stringicmp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\timer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TopicIDs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\TopicOps.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\trle.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\video.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\video_private.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vobject.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vobject_blitters.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vobject_private.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vsurface.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vsurface_private.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WCheck.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WinFont.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WizShare.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ZCONF.H"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ZLIB.H"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\Button Sound Control.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Button System.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Compression.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Container.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Cursor Control.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DbMan.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DEBUG.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\debug_util.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\debug_win_util.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DirectDraw Calls.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DirectX Common.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\English.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ExceptionHandling.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileCat.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileMan.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Flic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Font.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\himage.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\impTGA.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\input.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Install.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Ja2 Libs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\LibraryDataBase.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\line.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\MemMan.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\mousesystem.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Mutex Manager.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PCX.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PngLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Random.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\readdir.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\RegInst.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sgp.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sgp_logger.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\shading.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\soundman.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\STCI.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stringicmp.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\timer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\video.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vobject.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vobject_blitters.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\vsurface.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\WinFont.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -21,7 +21,7 @@
|
||||
OutputDirectory="..\lib\VS2008\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2008\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2_VS2008.vsprops;..\ja2_VS2008Debug.vsprops"
|
||||
InheritedPropertySheets="..\ja2.vsprops;..\ja2_Debug.vsprops"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
@@ -83,7 +83,7 @@
|
||||
OutputDirectory="..\lib\VS2008\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2008\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2_VS2008.vsprops"
|
||||
InheritedPropertySheets="..\ja2.vsprops"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
@@ -147,7 +147,7 @@
|
||||
OutputDirectory="..\lib\VS2008\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2008\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2_VS2008.vsprops;..\ja2_VS2008Editor.vsprops"
|
||||
InheritedPropertySheets="..\ja2.vsprops;..\ja2_Editor.vsprops"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
@@ -211,7 +211,7 @@
|
||||
OutputDirectory="..\lib\VS2008\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2008\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2_VS2008.vsprops;..\ja2_VS2008Editor.vsprops"
|
||||
InheritedPropertySheets="..\ja2.vsprops;..\ja2_Editor.vsprops"
|
||||
CharacterSet="0"
|
||||
>
|
||||
<Tool
|
||||
@@ -273,7 +273,7 @@
|
||||
OutputDirectory="..\lib\VS2008\$(ConfigurationName)"
|
||||
IntermediateDirectory="..\build\VS2008\$(ProjectName)_$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2_VS2008.vsprops"
|
||||
InheritedPropertySheets="..\ja2.vsprops"
|
||||
CharacterSet="0"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
@@ -375,6 +375,10 @@
|
||||
RelativePath="DEBUG.H"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\debug_util.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DirectDraw Calls.h"
|
||||
>
|
||||
@@ -495,6 +499,10 @@
|
||||
RelativePath="RAD.H"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\radbase.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="random.h"
|
||||
>
|
||||
@@ -511,6 +519,14 @@
|
||||
RelativePath="sgp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sgp_auto_memory.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sgp_logger.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="shading.h"
|
||||
>
|
||||
@@ -631,6 +647,14 @@
|
||||
RelativePath="DEBUG.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\debug_util.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\debug_win_util.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DirectDraw Calls.cpp"
|
||||
>
|
||||
@@ -727,6 +751,10 @@
|
||||
RelativePath="sgp.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\sgp_logger.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="shading.cpp"
|
||||
>
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="MapEditorD|Win32">
|
||||
<Configuration>MapEditorD</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="MapEditor|Win32">
|
||||
<Configuration>MapEditor</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Relese_WithDebugInfo|Win32">
|
||||
<Configuration>Relese_WithDebugInfo</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Bitmap.h" />
|
||||
<ClInclude Include="Button Sound Control.h" />
|
||||
<ClInclude Include="Button System.h" />
|
||||
<ClInclude Include="Compression.h" />
|
||||
<ClInclude Include="Container.h" />
|
||||
<ClInclude Include="Cursor Control.h" />
|
||||
<ClInclude Include="DbMan.h" />
|
||||
<ClInclude Include="ddraw.h" />
|
||||
<ClInclude Include="DEBUG.H" />
|
||||
<ClInclude Include="debug_util.h" />
|
||||
<ClInclude Include="DirectDraw Calls.h" />
|
||||
<ClInclude Include="DirectX Common.h" />
|
||||
<ClInclude Include="dsound.h" />
|
||||
<ClInclude Include="english.h" />
|
||||
<ClInclude Include="ExceptionHandling.h" />
|
||||
<ClInclude Include="expat.h" />
|
||||
<ClInclude Include="FileCat.h" />
|
||||
<ClInclude Include="FileMan.h" />
|
||||
<ClInclude Include="flic.h" />
|
||||
<ClInclude Include="fmod.h" />
|
||||
<ClInclude Include="fmod_errors.h" />
|
||||
<ClInclude Include="Font.h" />
|
||||
<ClInclude Include="himage.h" />
|
||||
<ClInclude Include="imgfmt.h" />
|
||||
<ClInclude Include="impTGA.h" />
|
||||
<ClInclude Include="input.h" />
|
||||
<ClInclude Include="Install.h" />
|
||||
<ClInclude Include="Ja2 Libs.h" />
|
||||
<ClInclude Include="JA2 SGP ALL.H" />
|
||||
<ClInclude Include="LibraryDataBase.h" />
|
||||
<ClInclude Include="line.h" />
|
||||
<ClInclude Include="MemMan.h" />
|
||||
<ClInclude Include="mousesystem.h" />
|
||||
<ClInclude Include="mousesystem_macros.h" />
|
||||
<ClInclude Include="Mss-old.h" />
|
||||
<ClInclude Include="Mss.h" />
|
||||
<ClInclude Include="Mutex Manager.h" />
|
||||
<ClInclude Include="pcx.h" />
|
||||
<ClInclude Include="PngLoader.h" />
|
||||
<ClInclude Include="RAD.H" />
|
||||
<ClInclude Include="radbase.h" />
|
||||
<ClInclude Include="random.h" />
|
||||
<ClInclude Include="readdir.h" />
|
||||
<ClInclude Include="RegInst.h" />
|
||||
<ClInclude Include="sgp.h" />
|
||||
<ClInclude Include="sgp_auto_memory.h" />
|
||||
<ClInclude Include="sgp_logger.h" />
|
||||
<ClInclude Include="shading.h" />
|
||||
<ClInclude Include="SMACK.H" />
|
||||
<ClInclude Include="soundman.h" />
|
||||
<ClInclude Include="STCI.h" />
|
||||
<ClInclude Include="stringicmp.h" />
|
||||
<ClInclude Include="timer.h" />
|
||||
<ClInclude Include="TopicIDs.h" />
|
||||
<ClInclude Include="TopicOps.h" />
|
||||
<ClInclude Include="trle.h" />
|
||||
<ClInclude Include="Types.h" />
|
||||
<ClInclude Include="video.h" />
|
||||
<ClInclude Include="video_private.h" />
|
||||
<ClInclude Include="vobject.h" />
|
||||
<ClInclude Include="vobject_blitters.h" />
|
||||
<ClInclude Include="vobject_private.h" />
|
||||
<ClInclude Include="vsurface.h" />
|
||||
<ClInclude Include="vsurface_private.h" />
|
||||
<ClInclude Include="WCheck.h" />
|
||||
<ClInclude Include="WinFont.h" />
|
||||
<ClInclude Include="WizShare.h" />
|
||||
<ClInclude Include="ZCONF.H" />
|
||||
<ClInclude Include="ZLIB.H" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Button Sound Control.cpp" />
|
||||
<ClCompile Include="Button System.cpp" />
|
||||
<ClCompile Include="Compression.cpp" />
|
||||
<ClCompile Include="Container.cpp" />
|
||||
<ClCompile Include="Cursor Control.cpp" />
|
||||
<ClCompile Include="DbMan.cpp" />
|
||||
<ClCompile Include="DEBUG.cpp" />
|
||||
<ClCompile Include="debug_util.cpp" />
|
||||
<ClCompile Include="debug_win_util.cpp" />
|
||||
<ClCompile Include="DirectDraw Calls.cpp" />
|
||||
<ClCompile Include="DirectX Common.cpp" />
|
||||
<ClCompile Include="English.cpp" />
|
||||
<ClCompile Include="ExceptionHandling.cpp" />
|
||||
<ClCompile Include="FileCat.cpp" />
|
||||
<ClCompile Include="FileMan.cpp" />
|
||||
<ClCompile Include="Flic.cpp" />
|
||||
<ClCompile Include="Font.cpp" />
|
||||
<ClCompile Include="himage.cpp" />
|
||||
<ClCompile Include="impTGA.cpp" />
|
||||
<ClCompile Include="input.cpp" />
|
||||
<ClCompile Include="Install.cpp" />
|
||||
<ClCompile Include="Ja2 Libs.cpp" />
|
||||
<ClCompile Include="LibraryDataBase.cpp" />
|
||||
<ClCompile Include="line.cpp" />
|
||||
<ClCompile Include="MemMan.cpp" />
|
||||
<ClCompile Include="mousesystem.cpp" />
|
||||
<ClCompile Include="Mutex Manager.cpp" />
|
||||
<ClCompile Include="PCX.cpp" />
|
||||
<ClCompile Include="PngLoader.cpp" />
|
||||
<ClCompile Include="Random.cpp" />
|
||||
<ClCompile Include="readdir.cpp" />
|
||||
<ClCompile Include="RegInst.cpp" />
|
||||
<ClCompile Include="sgp.cpp" />
|
||||
<ClCompile Include="sgp_logger.cpp" />
|
||||
<ClCompile Include="shading.cpp" />
|
||||
<ClCompile Include="soundman.cpp" />
|
||||
<ClCompile Include="STCI.cpp" />
|
||||
<ClCompile Include="stringicmp.cpp" />
|
||||
<ClCompile Include="timer.cpp" />
|
||||
<ClCompile Include="video.cpp" />
|
||||
<ClCompile Include="vobject.cpp" />
|
||||
<ClCompile Include="vobject_blitters.cpp" />
|
||||
<ClCompile Include="vsurface.cpp" />
|
||||
<ClCompile Include="WinFont.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{1237FA1E-6E76-4AB5-B569-45B01C691FAB}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>SGP</RootNamespace>
|
||||
<ProjectName>SGP</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MapEditorD|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MapEditor|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Relese_WithDebugInfo|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ja2.props" />
|
||||
<Import Project="..\ja2_Debug.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='MapEditorD|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ja2.props" />
|
||||
<Import Project="..\ja2_Debug.props" />
|
||||
<Import Project="..\ja2_Editor.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ja2.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='MapEditor|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ja2.props" />
|
||||
<Import Project="..\ja2_Editor.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Relese_WithDebugInfo|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ja2.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>..\lib\VS2010\$(Configuration)\</OutDir>
|
||||
<IntDir>..\build\VS2010\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MapEditorD|Win32'">
|
||||
<OutDir>..\lib\VS2010\$(Configuration)\</OutDir>
|
||||
<IntDir>..\build\VS2010\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IntDir>..\build\VS2010\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
<OutDir>..\lib\VS2010\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MapEditor|Win32'">
|
||||
<IntDir>..\build\VS2010\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
<OutDir>..\lib\VS2010\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Relese_WithDebugInfo|Win32'">
|
||||
<IntDir>..\build\VS2010\$(ProjectName)_$(Configuration)\</IntDir>
|
||||
<OutDir>..\lib\VS2010\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MapEditorD|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;NO_ZLIB_COMPRESSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MapEditor|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Relese_WithDebugInfo|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;NO_ZLIB_COMPRESSION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,354 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{efcdc6de-effe-499c-865f-bbb1cd30a876}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{3abaeda9-a6ab-443e-9e82-5b43020f6328}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Bitmap.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mss-old.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Button Sound Control.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Button System.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Compression.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Container.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Cursor Control.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DbMan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ddraw.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DEBUG.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="debug_util.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DirectDraw Calls.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DirectX Common.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dsound.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="english.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ExceptionHandling.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="expat.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileCat.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileMan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="flic.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="fmod.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="fmod_errors.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Font.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="himage.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="imgfmt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="impTGA.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="input.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Install.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Ja2 Libs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="JA2 SGP ALL.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LibraryDataBase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="line.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MemMan.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mousesystem.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mousesystem_macros.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZLIB.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mss.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Mutex Manager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pcx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PngLoader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RAD.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="random.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="readdir.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RegInst.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sgp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sgp_auto_memory.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="shading.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SMACK.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="soundman.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="STCI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stringicmp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="timer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TopicIDs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TopicOps.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="trle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="video.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="video_private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vobject.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vobject_blitters.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vobject_private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vsurface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="vsurface_private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WCheck.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WinFont.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WizShare.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ZCONF.H">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sgp_logger.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="radbase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Button Sound Control.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Button System.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Compression.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Container.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Cursor Control.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DbMan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DEBUG.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="debug_util.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="debug_win_util.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DirectDraw Calls.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DirectX Common.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="English.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ExceptionHandling.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FileCat.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FileMan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Flic.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Font.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="himage.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="impTGA.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="input.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Install.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Ja2 Libs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LibraryDataBase.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="line.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MemMan.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mousesystem.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Mutex Manager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PCX.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PngLoader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Random.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="readdir.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RegInst.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sgp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="shading.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="soundman.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="STCI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stringicmp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="timer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="video.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vobject.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vobject_blitters.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="vsurface.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WinFont.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="sgp_logger.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -33,8 +33,10 @@
|
||||
|
||||
#if defined( JA2 ) || defined( UTILS )
|
||||
typedef unsigned int UINT32;
|
||||
typedef __int64 INT64; // WANNE - BMP: Used for Big Maps
|
||||
typedef signed __int64 INT64; // WANNE - BMP: Used for Big Maps
|
||||
typedef signed int INT32;
|
||||
typedef unsigned __int64 UINT64;
|
||||
typedef unsigned long long UINT128;
|
||||
#else
|
||||
typedef unsigned int UINT32;
|
||||
typedef int INT32;
|
||||
@@ -132,4 +134,52 @@ typedef VECTOR4 MATRIX4[4]; // 4x4 matrix
|
||||
typedef VECTOR4 COLOR; // rgba color array
|
||||
|
||||
|
||||
#include <vfs/Aspects/vfs_settings.h>
|
||||
#include <vfs/Core/vfs_string.h>
|
||||
|
||||
inline void convert_string(std::wstring const& str_in, std::string &str_out)
|
||||
{
|
||||
#if !defined(USE_VFS)
|
||||
const wchar_t* src = str_in.c_str();
|
||||
size_t len = wcstombs(NULL, src, str_in.length());
|
||||
if(len > 0)
|
||||
{
|
||||
str_out.resize(len);
|
||||
wcstombs(&str_out[0], src, len);
|
||||
}
|
||||
#else
|
||||
if(vfs::Settings::getUseUnicode())
|
||||
{
|
||||
str_out = vfs::String::as_utf8(str_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
vfs::String::narrow(str_in, str_out);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void convert_string(std::string const& str_in, std::wstring &str_out)
|
||||
{
|
||||
#if !defined(USE_VFS)
|
||||
const char* src = str_in.c_str();
|
||||
size_t len = mbstowcs(NULL, src, str_in.length());
|
||||
if(len > 0)
|
||||
{
|
||||
str_out.resize(len);
|
||||
mbstowcs(&str_out[0], src, len);
|
||||
}
|
||||
#else
|
||||
if(vfs::Settings::getUseUnicode())
|
||||
{
|
||||
vfs::String::as_utf16(str_in, str_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
vfs::String::widen(str_in, str_out);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "debug_util.h"
|
||||
|
||||
const void *const *StackTrace::Addresses(size_t* count) {
|
||||
*count = trace_.size();
|
||||
if (trace_.size())
|
||||
return &trace_[0];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void sgp::dumpStackTrace(vfs::String const& msg)
|
||||
{
|
||||
// the first error is the important one anyway
|
||||
static bool already_dumping = false;
|
||||
|
||||
if(!already_dumping) // needs a mutes to be sure
|
||||
{
|
||||
already_dumping = true;
|
||||
StackTrace str;
|
||||
str.PrintBacktrace(msg.utf8().c_str());
|
||||
already_dumping = false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
StackTrace::StackTrace()
|
||||
{
|
||||
}
|
||||
|
||||
void StackTrace::PrintBacktrace(const char* msg)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// This is a cross platform interface for helper functions related to debuggers.
|
||||
// You should use this to test if you're running under a debugger, and if you
|
||||
// would like to yield (breakpoint) into the debugger.
|
||||
|
||||
#ifndef BASE_DEBUG_UTIL_H_
|
||||
#define BASE_DEBUG_UTIL_H_
|
||||
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
|
||||
#include "sgp_logger.h"
|
||||
|
||||
// A macro to disallow the copy constructor and operator= functions
|
||||
// This should be used in the private: declarations for a class
|
||||
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
TypeName(const TypeName&); \
|
||||
void operator=(const TypeName&)
|
||||
|
||||
// An older, deprecated, politically incorrect name for the above.
|
||||
#define DISALLOW_EVIL_CONSTRUCTORS(TypeName) DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
|
||||
// A stacktrace can be helpful in debugging. For example, you can include a
|
||||
// stacktrace member in a object (probably around #ifndef NDEBUG) so that you
|
||||
// can later see where the given object was created from.
|
||||
class StackTrace {
|
||||
public:
|
||||
// Create a stacktrace from the current location
|
||||
StackTrace();
|
||||
// Get an array of instruction pointer values.
|
||||
// count: (output) the number of elements in the returned array
|
||||
const void *const *Addresses(size_t* count);
|
||||
// Print a backtrace to stderr
|
||||
void PrintBacktrace(const char* msg);
|
||||
|
||||
// Resolve backtrace to symbols and write to stream.
|
||||
void OutputToStream(const char* msg, sgp::Logger::LogInstance* os);
|
||||
|
||||
private:
|
||||
std::vector<void*> trace_;
|
||||
int count_;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(StackTrace);
|
||||
};
|
||||
|
||||
namespace sgp
|
||||
{
|
||||
void dumpStackTrace(vfs::String const& msg);
|
||||
}
|
||||
|
||||
#endif // BASE_DEBUG_UTIL_H_
|
||||
@@ -0,0 +1,223 @@
|
||||
// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#include "debug_util.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#include <dbghelp.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <vfs/Tools/vfs_log.h>
|
||||
|
||||
|
||||
|
||||
// The arraysize(arr) macro returns the # of elements in an array arr.
|
||||
// The expression is a compile-time constant, and therefore can be
|
||||
// used in defining new arrays, for example. If you use arraysize on
|
||||
// a pointer by mistake, you will get a compile-time error.
|
||||
//
|
||||
// One caveat is that arraysize() doesn't accept any array of an
|
||||
// anonymous type or a type defined inside a function. In these rare
|
||||
// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is
|
||||
// due to a limitation in C++'s template system. The limitation might
|
||||
// eventually be removed, but it hasn't happened yet.
|
||||
|
||||
// This template function declaration is used in defining arraysize.
|
||||
// Note that the function doesn't need an implementation, as we only
|
||||
// use its type.
|
||||
template <typename T, size_t N>
|
||||
char (&ArraySizeHelper(T (&array)[N]))[N];
|
||||
|
||||
// That gcc wants both of these prototypes seems mysterious. VC, for
|
||||
// its part, can't decide which to use (another mystery). Matching of
|
||||
// template overloads: the final frontier.
|
||||
#ifndef _MSC_VER
|
||||
template <typename T, size_t N>
|
||||
char (&ArraySizeHelper(const T (&array)[N]))[N];
|
||||
#endif
|
||||
|
||||
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
|
||||
|
||||
|
||||
namespace {
|
||||
// SymbolContext is a threadsafe singleton that wraps the DbgHelp Sym* family
|
||||
// of functions. The Sym* family of functions may only be invoked by one
|
||||
// thread at a time. SymbolContext code may access a symbol server over the
|
||||
// network while holding the lock for this singleton. In the case of high
|
||||
// latency, this code will adversly affect performance.
|
||||
//
|
||||
// There is also a known issue where this backtrace code can interact
|
||||
// badly with breakpad if breakpad is invoked in a separate thread while
|
||||
// we are using the Sym* functions. This is because breakpad does now
|
||||
// share a lock with this function. See this related bug:
|
||||
//
|
||||
// http://code.google.com/p/google-breakpad/issues/detail?id=311
|
||||
//
|
||||
// This is a very unlikely edge case, and the current solution is to
|
||||
// just ignore it.
|
||||
class SymbolContext {
|
||||
public:
|
||||
static SymbolContext* Get() {
|
||||
static SymbolContext* s_singleton = NULL;
|
||||
if(!s_singleton) s_singleton = new SymbolContext();
|
||||
return s_singleton;
|
||||
// We use a leaky singleton because code may call this during process
|
||||
// termination.
|
||||
|
||||
//return Singleton<SymbolContext, LeakySingletonTraits<SymbolContext> >::get();
|
||||
}
|
||||
|
||||
// Returns the error code of a failed initialization.
|
||||
DWORD init_error() const {
|
||||
return init_error_;
|
||||
}
|
||||
|
||||
// For the given trace, attempts to resolve the symbols, and output a trace
|
||||
// to the ostream os. The format for each line of the backtrace is:
|
||||
//
|
||||
// <tab>SymbolName[0xAddress+Offset] (FileName:LineNo)
|
||||
//
|
||||
// This function should only be called if Init() has been called. We do not
|
||||
// LOG(FATAL) here because this code is called might be triggered by a
|
||||
// LOG(FATAL) itself.
|
||||
void OutputTraceToStream(const std::vector<void*>& trace, sgp::Logger::LogInstance* os) {
|
||||
//AutoLock lock(lock_);
|
||||
|
||||
for (size_t i = 0; (i < trace.size()); ++i) {
|
||||
const int kMaxNameLength = 256;
|
||||
DWORD_PTR frame = reinterpret_cast<DWORD_PTR>(trace[i]);
|
||||
|
||||
// Code adapted from MSDN example:
|
||||
// http://msdn.microsoft.com/en-us/library/ms680578(VS.85).aspx
|
||||
ULONG64 buffer[
|
||||
(sizeof(SYMBOL_INFO) +
|
||||
kMaxNameLength * sizeof(wchar_t) +
|
||||
sizeof(ULONG64) - 1) /
|
||||
sizeof(ULONG64)];
|
||||
|
||||
// Initialize symbol information retrieval structures.
|
||||
DWORD64 sym_displacement = 0;
|
||||
PSYMBOL_INFO symbol = reinterpret_cast<PSYMBOL_INFO>(&buffer[0]);
|
||||
symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
|
||||
symbol->MaxNameLen = kMaxNameLength;
|
||||
BOOL has_symbol = SymFromAddr(GetCurrentProcess(), frame,
|
||||
&sym_displacement, symbol);
|
||||
|
||||
// Attempt to retrieve line number information.
|
||||
DWORD line_displacement = 0;
|
||||
IMAGEHLP_LINE64 line = {};
|
||||
line.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||
BOOL has_line = SymGetLineFromAddr64(GetCurrentProcess(), frame,
|
||||
&line_displacement, &line);
|
||||
|
||||
// Output the backtrace line.
|
||||
(*os) << " ";
|
||||
if (has_symbol)
|
||||
{
|
||||
(*os) << " [0x" << trace[i] << "+" << sym_displacement << "]\t";
|
||||
(*os) << vfs::String(symbol->Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
(*os) << " [0x" << trace[i] << "]\t";
|
||||
// If there is no symbol information, add a spacer.
|
||||
(*os) << " (No symbol)";
|
||||
}
|
||||
if (has_line)
|
||||
{
|
||||
(*os) << " - (" << line.FileName << ":" << line.LineNumber << ")";
|
||||
}
|
||||
(*os) << sgp::endl;
|
||||
}
|
||||
(*os) << sgp::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
SymbolContext() : init_error_(ERROR_SUCCESS) {
|
||||
// Initializes the symbols for the process.
|
||||
// Defer symbol load until they're needed, use undecorated names, and
|
||||
// get line numbers.
|
||||
SymSetOptions(SYMOPT_DEFERRED_LOADS |
|
||||
SYMOPT_UNDNAME |
|
||||
SYMOPT_LOAD_LINES);
|
||||
if (SymInitialize(GetCurrentProcess(), NULL, TRUE)) {
|
||||
init_error_ = ERROR_SUCCESS;
|
||||
} else {
|
||||
__debugbreak();
|
||||
init_error_ = GetLastError();
|
||||
}
|
||||
}
|
||||
|
||||
DWORD init_error_;
|
||||
//Lock lock_;
|
||||
DISALLOW_COPY_AND_ASSIGN(SymbolContext);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#define ENABLE_STACK_TRACE 0
|
||||
StackTrace::StackTrace() {
|
||||
// From http://msdn.microsoft.com/en-us/library/bb204633(VS.85).aspx,
|
||||
// the sum of FramesToSkip and FramesToCapture must be less than 63,
|
||||
// so set it to 62.
|
||||
const int kMaxCallers = 62;
|
||||
|
||||
void* callers[kMaxCallers];
|
||||
// TODO(ajwong): Migrate this to StackWalk64.
|
||||
|
||||
// WANNE: VS 2005 compilation error
|
||||
// WANNE: I disabled the method call "CaptureStackBackTrace()" because it gives a compilation error in VS 2005
|
||||
#if ENABLE_STACK_TRACE
|
||||
int count = CaptureStackBackTrace(0, kMaxCallers, callers, NULL);
|
||||
|
||||
// WANNE: This also does not work in VS 2005
|
||||
//int count = RtlCaptureStackBackTrace(0, kMaxCallers, callers, NULL);
|
||||
if (count > 0) {
|
||||
trace_.resize(count);
|
||||
memcpy(&trace_[0], callers, sizeof(callers[0]) * count);
|
||||
} else {
|
||||
trace_.resize(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static struct StackTraceLog {
|
||||
sgp::Logger_ID id;
|
||||
StackTraceLog() {
|
||||
id = sgp::Logger::instance().createLogger();
|
||||
sgp::Logger::instance().connectFile(id, L"stack_trace.log", false, sgp::Logger::FLUSH_ON_ENDL);
|
||||
};
|
||||
} s_log;
|
||||
|
||||
void StackTrace::PrintBacktrace(const char* msg) {
|
||||
OutputToStream(msg, &(SGP_LOG(s_log.id)));
|
||||
}
|
||||
|
||||
void StackTrace::OutputToStream(const char* msg, sgp::Logger::LogInstance* os) {
|
||||
SymbolContext* context = SymbolContext::Get();
|
||||
DWORD error = context->init_error();
|
||||
if (error != ERROR_SUCCESS)
|
||||
{
|
||||
(*os) << "Error initializing symbols (" << error
|
||||
<< "). Dumping unresolved backtrace:"
|
||||
<< sgp::endl;
|
||||
for (size_t i = 0; (i < trace_.size()); ++i)
|
||||
{
|
||||
(*os) << "\t" << trace_[i] << sgp::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(*os) << L"Backtrace: " << (msg != NULL ? msg : "") << sgp::endl;
|
||||
context->OutputTraceToStream(trace_, os);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _MSC_VER
|
||||
@@ -20,9 +20,9 @@
|
||||
#include "vobject.h"
|
||||
#endif
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include <vfs/Core/vfs.h>
|
||||
|
||||
const utf8string::str_t CONST_DOTJPC(L".jpc.7z");
|
||||
const vfs::String::str_t CONST_DOTJPC(L".jpc.7z");
|
||||
|
||||
|
||||
|
||||
@@ -52,14 +52,92 @@ typedef union
|
||||
UINT32 uiValue;
|
||||
} SplitUINT32;
|
||||
|
||||
HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
|
||||
namespace ImageFileType
|
||||
{
|
||||
HIMAGE hImage = NULL;
|
||||
SGPFILENAME Extension;
|
||||
CHAR8 ExtensionSep[] = ".";
|
||||
STR StrPtr;
|
||||
typedef std::map<vfs::String, int, vfs::String::Less> ExtMap_t;
|
||||
|
||||
static int map(vfs::String const& ext)
|
||||
{
|
||||
static ExtMap_t _ext_map;
|
||||
static bool inited = false;
|
||||
if(!inited)
|
||||
{
|
||||
_ext_map["pcx"] = PCX_FILE_READER;
|
||||
_ext_map["tga"] = TGA_FILE_READER;
|
||||
_ext_map["sti"] = STCI_FILE_READER;
|
||||
_ext_map["png"] = PNG_FILE_READER;
|
||||
_ext_map["jpc.7z"] = JPC_FILE_READER;
|
||||
inited = true;
|
||||
}
|
||||
ExtMap_t::const_iterator cit = _ext_map.find(ext);
|
||||
if(cit != _ext_map.end())
|
||||
{
|
||||
return cit->second;
|
||||
}
|
||||
return UNKNOWN_FILE_READER;
|
||||
}
|
||||
|
||||
static int getFileReaderType(std::string& filename, TestOrder order)
|
||||
{
|
||||
std::string::size_type pos = filename.find_last_of(".");
|
||||
std::string ext = filename.substr(pos+1, std::string::npos);
|
||||
if(ext.empty())
|
||||
{
|
||||
ext = "pcx";
|
||||
filename += ".pcx";
|
||||
}
|
||||
int reader_type = map(ext);
|
||||
|
||||
/*
|
||||
* if DEFAULT, then just check existance of file
|
||||
* if not STI, then there is no different load order, just continue as usual
|
||||
*/
|
||||
if(order == DEFAULT || reader_type != STCI_FILE_READER)
|
||||
{
|
||||
return getVFS()->fileExists(filename) ? reader_type : UNKNOWN_FILE_READER;
|
||||
}
|
||||
/*
|
||||
* file must have originally been an STI file, but should be treated as a JPC or a PNG file
|
||||
*/
|
||||
else if(order == JPC || order == PNG)
|
||||
{
|
||||
vfs::String file = filename.substr(0, pos+1).append(order == JPC ? "jpc.7z" : "png");
|
||||
if( getVFS()->fileExists(file) )
|
||||
{
|
||||
filename = file.utf8();
|
||||
return order == JPC ? JPC_FILE_READER : PNG_FILE_READER;
|
||||
}
|
||||
return UNKNOWN_FILE_READER;
|
||||
}
|
||||
/*
|
||||
* file must have originally been an STI file, but should be treated as a JPC or a PNG file
|
||||
* if the replacement filetypes don't exist, fall back to STI
|
||||
*/
|
||||
else if(order == JPC_FALLBACK || order == PNG_FALLBACK)
|
||||
{
|
||||
vfs::String file = filename.substr(0, pos+1).append(order == JPC_FALLBACK ? "jpc.7z" : "png");
|
||||
if( getVFS()->fileExists(file) )
|
||||
{
|
||||
filename = file.utf8();
|
||||
return order == JPC_FALLBACK ? JPC_FILE_READER : PNG_FILE_READER;
|
||||
}
|
||||
// fallback to original type
|
||||
return getVFS()->fileExists(filename) ? reader_type : UNKNOWN_FILE_READER;
|
||||
}
|
||||
return UNKNOWN_FILE_READER;
|
||||
}
|
||||
};
|
||||
|
||||
HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents, ImageFileType::TestOrder order )
|
||||
{
|
||||
HIMAGE hImage = NULL;
|
||||
CHAR8 ExtensionSep[] = ".";
|
||||
UINT32 iFileLoader;
|
||||
|
||||
#if 0
|
||||
SGPFILENAME Extension;
|
||||
STR StrPtr;
|
||||
|
||||
// Depending on extension of filename, use different image readers
|
||||
// Get extension
|
||||
StrPtr = strstr( ImageFile, ExtensionSep );
|
||||
@@ -96,9 +174,9 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
|
||||
#ifdef USE_VFS
|
||||
// see if there is a .jpc file first and when that fails, try .sti
|
||||
vfs::Path str(ImageFile);
|
||||
utf8string::str_t const& findext = str.c_wcs();
|
||||
utf8string::size_t dot = findext.find_last_of(vfs::Const::DOT());
|
||||
utf8string fname = findext.substr(0,dot).append(CONST_DOTJPC);
|
||||
vfs::String::str_t const& findext = str.c_wcs();
|
||||
vfs::String::size_t dot = findext.find_last_of(vfs::Const::DOT());
|
||||
vfs::String fname = findext.substr(0,dot).append(CONST_DOTJPC);
|
||||
if(getVFS()->fileExists(fname))
|
||||
{
|
||||
iFileLoader = JPC_FILE_READER;
|
||||
@@ -116,7 +194,7 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
|
||||
break;
|
||||
}
|
||||
#ifdef USE_VFS
|
||||
else if ( StrCmp::Equal(Extension, L"jpc.7z") )
|
||||
else if ( vfs::StrCmp::Equal(Extension, L"jpc.7z") )
|
||||
{
|
||||
iFileLoader = JPC_FILE_READER;
|
||||
break;
|
||||
@@ -137,6 +215,23 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
#else
|
||||
std::string filename(ImageFile);
|
||||
iFileLoader = ImageFileType::getFileReaderType(filename, order);
|
||||
if ( iFileLoader == UNKNOWN_FILE_READER )
|
||||
{
|
||||
//If in debug, make fatal!
|
||||
#ifdef JA2
|
||||
#ifdef _DEBUG
|
||||
//FatalError( "Resource file %s does not exist.", ImageFile );
|
||||
#endif
|
||||
#endif
|
||||
DbgMessage( TOPIC_HIMAGE, DBG_LEVEL_2, String("Resource file %s does not exist.", ImageFile) );
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Create memory for image structure
|
||||
hImage = (HIMAGE)MemAlloc( sizeof( image_type ) );
|
||||
@@ -152,7 +247,7 @@ HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents )
|
||||
//hImage->pui16BPPPalette = NULL;
|
||||
|
||||
// Set filename and loader
|
||||
strcpy( hImage->ImageFile, ImageFile );
|
||||
strncpy( hImage->ImageFile, /*ImageFile*/filename.c_str(), filename.length() );
|
||||
hImage->iFileLoader = iFileLoader;
|
||||
|
||||
if ( !LoadImageData( hImage, fContents ) )
|
||||
|
||||
@@ -138,9 +138,21 @@ typedef struct
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
namespace ImageFileType
|
||||
{
|
||||
enum TestOrder
|
||||
{
|
||||
DEFAULT = 0, // check extension
|
||||
JPC, // ignore file extension, test only *.jpc
|
||||
JPC_FALLBACK, // test *.jpc, fallback to original type
|
||||
PNG, // ignore file extension, test only *.png
|
||||
PNG_FALLBACK, // test *.png, fallback to original type
|
||||
};
|
||||
};
|
||||
|
||||
// This function will return NULL if it fails, and call SetLastError() to set
|
||||
// error information
|
||||
HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents );
|
||||
HIMAGE CreateImage( SGPFILENAME ImageFile, UINT16 fContents, ImageFileType::TestOrder order = ImageFileType::JPC_FALLBACK);
|
||||
|
||||
// This function destroys the HIMAGE structure as well as its contents
|
||||
BOOLEAN DestroyImage( HIMAGE hImage );
|
||||
|
||||
+104
-279
@@ -8,6 +8,10 @@
|
||||
#elif defined( WIZ8_PRECOMPILED_HEADERS )
|
||||
#include "WIZ8 SGP ALL.H"
|
||||
#else
|
||||
//** dd äëÿ ïîäêëþ÷åíèÿ äåôàéíîâ äîï. êíîïîê ìûøè
|
||||
#define _WIN32_WINNT 0x500
|
||||
|
||||
//**
|
||||
#include "types.h"
|
||||
#include <windows.h>
|
||||
#include <winuser.h>//dnl
|
||||
@@ -69,12 +73,18 @@ BOOLEAN gfRecordedLeftButtonUp;
|
||||
|
||||
UINT32 guiLeftButtonRepeatTimer;
|
||||
UINT32 guiRightButtonRepeatTimer;
|
||||
UINT32 guiMiddleButtonRepeatTimer;
|
||||
UINT32 guiX1ButtonRepeatTimer;
|
||||
UINT32 guiX2ButtonRepeatTimer;
|
||||
|
||||
BOOLEAN gfTrackMousePos; // TRUE = queue mouse movement events, FALSE = don't
|
||||
BOOLEAN gfLeftButtonState; // TRUE = Pressed, FALSE = Not Pressed
|
||||
BOOLEAN gfRightButtonState; // TRUE = Pressed, FALSE = Not Pressed
|
||||
BOOLEAN gfMiddleButtonState;//dnl TRUE = Pressed, FALSE = Not Pressed
|
||||
INT16 gsMouseWheelDeltaValue;//dnl positive value indicates that the wheel was rotated forward, negative value indicates that the wheel was rotated backward, and user handler procedure for mouse wheel should restore after usege this value to zero!
|
||||
//INT16 gsMouseWheelDeltaValue;//dnl positive value indicates that the wheel was rotated forward, negative value indicates that the wheel was rotated backward, and user handler procedure for mouse wheel should restore after usege this value to zero!
|
||||
BOOLEAN gfX1ButtonState;
|
||||
BOOLEAN gfX2ButtonState;
|
||||
|
||||
INT16 gusMouseXPos; // X position of the mouse on screen
|
||||
INT16 gusMouseYPos; // y position of the mouse on screen
|
||||
|
||||
@@ -104,322 +114,131 @@ StringInput *gpCurrentStringDescriptor;
|
||||
|
||||
void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam);
|
||||
void RedirectToString(UINT16 uiInputCharacter);
|
||||
void HandleSingleClicksAndButtonRepeats( void );
|
||||
void AdjustMouseForWindowOrigin(void);
|
||||
void HandleSingleClicksAndButtonRepeats( void );
|
||||
void AdjustMouseForWindowOrigin(void);
|
||||
|
||||
// These are the hook functions for both keyboard and mouse
|
||||
|
||||
LRESULT CALLBACK KeyboardHandler(int Code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#ifndef JA2
|
||||
if((Code < 0) || (!gfApplicationActive))
|
||||
#else
|
||||
if (Code < 0)
|
||||
#endif
|
||||
{ // Do not handle this message, pass it on to another window
|
||||
return CallNextHookEx(ghKeyboardHook, Code, wParam, lParam);
|
||||
}
|
||||
if (Code < 0) // Do not handle this message, pass it on to another window
|
||||
return CallNextHookEx(ghKeyboardHook, Code, wParam, lParam);
|
||||
|
||||
if (lParam & TRANSITION_MASK)
|
||||
{ // The key has been released
|
||||
KeyUp(wParam, lParam);
|
||||
//gfSGPInputReceived = TRUE;
|
||||
}
|
||||
if (lParam & TRANSITION_MASK) // The key has been released
|
||||
KeyUp(wParam, lParam); //gfSGPInputReceived = TRUE;
|
||||
else
|
||||
{ // Key was up
|
||||
KeyDown(wParam, lParam);
|
||||
gfSGPInputReceived = TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef JA2
|
||||
|
||||
LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UINT32 uiParam;
|
||||
POINT mpos;
|
||||
MOUSEHOOKSTRUCTEX* p_mhs;
|
||||
|
||||
#ifndef JA2
|
||||
if((Code < 0) || (!gfApplicationActive))
|
||||
#else
|
||||
if (Code < 0)
|
||||
#endif
|
||||
{ // Do not handle this message, pass it on to another window
|
||||
return CallNextHookEx(ghMouseHook, Code, wParam, lParam);
|
||||
}
|
||||
if (Code < 0) // Do not handle this message, pass it on to another window
|
||||
return CallNextHookEx(ghMouseHook, Code, wParam, lParam);
|
||||
|
||||
p_mhs = (MOUSEHOOKSTRUCTEX*)lParam;
|
||||
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient( ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
switch (wParam)
|
||||
{
|
||||
case WM_LBUTTONDOWN :
|
||||
// Update the current mouse position
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient( ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
// Update the button state
|
||||
gfLeftButtonState = TRUE;
|
||||
|
||||
//Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
|
||||
// Trigger an input event
|
||||
QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam);
|
||||
case WM_XBUTTONDOWN://** êîä ðàáî÷èé
|
||||
if( p_mhs->mouseData== (XBUTTON1<<16) ) //MessageBeep(-1);
|
||||
{
|
||||
gfX1ButtonState = TRUE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(X1_BUTTON_DOWN, 0, uiParam);
|
||||
}
|
||||
if( p_mhs->mouseData== (XBUTTON2<<16) ) //MessageBeep(0x00000040L);
|
||||
{
|
||||
gfX2ButtonState = TRUE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(X2_BUTTON_DOWN, 0, uiParam);
|
||||
}
|
||||
break;
|
||||
case WM_LBUTTONUP :
|
||||
// Update the current mouse position
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient( ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
// Update the button state
|
||||
gfLeftButtonState = FALSE;
|
||||
|
||||
// Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
|
||||
// Trigger an input event
|
||||
QueueEvent(LEFT_BUTTON_UP, 0, uiParam);
|
||||
case WM_XBUTTONUP://** êîä ðàáî÷èé
|
||||
if( p_mhs->mouseData== (XBUTTON1<<16) )
|
||||
{
|
||||
gfX1ButtonState = FALSE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(X1_BUTTON_UP, 0, uiParam);
|
||||
}
|
||||
if( p_mhs->mouseData== (XBUTTON2<<16) )
|
||||
{
|
||||
gfX2ButtonState = FALSE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(X2_BUTTON_UP, 0, uiParam);
|
||||
}
|
||||
break;
|
||||
case WM_RBUTTONDOWN :
|
||||
// Update the current mouse position
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient( ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
// Update the button state
|
||||
gfRightButtonState = TRUE;
|
||||
|
||||
// Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
|
||||
// Trigger an input event
|
||||
QueueEvent(RIGHT_BUTTON_DOWN, 0, uiParam);
|
||||
case WM_MOUSEWHEEL:
|
||||
if(p_mhs->mouseData==(WHEEL_DELTA<<16)) //up MessageBeep(-1);
|
||||
QueueEvent(MOUSE_WHEEL_UP, 0, uiParam);
|
||||
if(p_mhs->mouseData==(-WHEEL_DELTA<<16)) //dn MessageBeep(0x00000040L);
|
||||
QueueEvent(MOUSE_WHEEL_DOWN, 0, uiParam);
|
||||
break;
|
||||
case WM_RBUTTONUP :
|
||||
// Update the current mouse position
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient( ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
// Update the button state
|
||||
gfRightButtonState = FALSE;
|
||||
|
||||
//Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
|
||||
// Trigger an input event
|
||||
QueueEvent(RIGHT_BUTTON_UP, 0, uiParam);
|
||||
case WM_MBUTTONDOWN:
|
||||
gfMiddleButtonState= TRUE; //Set that we have input
|
||||
gfSGPInputReceived = TRUE;//Set that we have input
|
||||
QueueEvent(MIDDLE_BUTTON_DOWN, 0, uiParam);// Trigger an input event
|
||||
break;
|
||||
|
||||
//dnl begin part for additional mouse events
|
||||
case WM_MBUTTONDOWN :
|
||||
// Update the current mouse position
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient(ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
// Update the button state
|
||||
gfMiddleButtonState = TRUE;
|
||||
|
||||
//Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
|
||||
// Trigger an input event
|
||||
QueueEvent(MIDDLE_BUTTON_DOWN, 0, uiParam);
|
||||
break;
|
||||
case WM_MBUTTONUP :
|
||||
// Update the current mouse position
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient(ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
// Update the button state
|
||||
gfMiddleButtonState = FALSE;
|
||||
|
||||
//Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
|
||||
// Trigger an input event
|
||||
case WM_MBUTTONUP:
|
||||
gfMiddleButtonState= FALSE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(MIDDLE_BUTTON_UP, 0, uiParam);
|
||||
break;
|
||||
//case WM_MBUTTONDBLCLK:
|
||||
// break;
|
||||
case WM_MOUSEWHEEL :
|
||||
// Update the current mouse position
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient(ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
// Update mouse wheel delta value
|
||||
gsMouseWheelDeltaValue = GetMouseWheelDeltaValue(((MOUSEHOOKSTRUCTEX *)lParam)->mouseData);
|
||||
|
||||
//Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
|
||||
// Trigger an input event
|
||||
QueueEvent(MOUSE_WHEEL, 0, uiParam);
|
||||
case WM_LBUTTONDOWN:
|
||||
gfLeftButtonState = TRUE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam);
|
||||
break;
|
||||
|
||||
//dnl end part for additional mouse events
|
||||
case WM_MOUSEMOVE :
|
||||
// Update the current mouse position
|
||||
mpos = ((MOUSEHOOKSTRUCT *)lParam)->pt;
|
||||
ScreenToClient( ghWindow, &mpos);
|
||||
gusMouseXPos = (INT16)mpos.x;
|
||||
gusMouseYPos = (INT16)mpos.y;
|
||||
uiParam = gusMouseYPos;
|
||||
uiParam = uiParam << 16;
|
||||
uiParam = uiParam | gusMouseXPos;
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
gfLeftButtonState = FALSE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(LEFT_BUTTON_UP, 0, uiParam);
|
||||
break;
|
||||
case WM_RBUTTONDOWN:
|
||||
gfRightButtonState = TRUE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(RIGHT_BUTTON_DOWN, 0, uiParam);
|
||||
break;
|
||||
case WM_RBUTTONUP:
|
||||
gfRightButtonState = FALSE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
QueueEvent(RIGHT_BUTTON_UP, 0, uiParam);
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
// Trigger an input event
|
||||
if (gfTrackMousePos == TRUE)
|
||||
{
|
||||
QueueEvent(MOUSE_POS, 0, uiParam);
|
||||
}
|
||||
//Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
gfSGPInputReceived = TRUE;
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
return CallNextHookEx(ghMouseHook, Code, wParam, lParam);
|
||||
}
|
||||
|
||||
//ddd why below code commented?
|
||||
// if (gusMouseXPos < 0 || gusMouseXPos >= SCREEN_WIDTH ||
|
||||
// gusMouseYPos < 0 || gusMouseYPos >= SCREEN_HEIGHT)
|
||||
{
|
||||
return CallNextHookEx(ghMouseHook, Code, wParam, lParam);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// Wizardry mouse hander
|
||||
|
||||
LRESULT CALLBACK MouseHandler(int Code, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UINT32 uiParam;
|
||||
UINT32 uiXPos, uiYPos;
|
||||
RECT rcClient;
|
||||
BOOLEAN fOutsideClient=FALSE;
|
||||
static BOOLEAN fResizing=FALSE;
|
||||
LRESULT Result;
|
||||
|
||||
uiXPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).x;
|
||||
uiYPos= (((MOUSEHOOKSTRUCT *)lParam)->pt).y;
|
||||
|
||||
if(!VideoIsFullScreen())
|
||||
{
|
||||
if(wParam==WM_NCLBUTTONDOWN)
|
||||
{
|
||||
fResizing=TRUE;
|
||||
}
|
||||
VideoGetClientRect(&rcClient);
|
||||
if((uiXPos < (UINT32)rcClient.left) || (uiXPos > (UINT32)rcClient.right) || (uiYPos < (UINT32)rcClient.top) || (uiYPos > (UINT32)rcClient.bottom))
|
||||
{
|
||||
fOutsideClient=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if((Code < 0) || (!gfApplicationActive) || fOutsideClient || fResizing)
|
||||
{
|
||||
// Do not handle this message, pass it on to another window
|
||||
Result = CallNextHookEx(ghMouseHook, Code, wParam, lParam);
|
||||
|
||||
if((wParam==WM_LBUTTONUP) || (wParam==WM_NCLBUTTONUP))
|
||||
{
|
||||
fResizing=FALSE;
|
||||
}
|
||||
return(Result);
|
||||
}
|
||||
|
||||
switch (wParam)
|
||||
{
|
||||
case WM_LBUTTONUP:
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MOUSEMOVE:
|
||||
if(VideoIsFullScreen())
|
||||
{
|
||||
gusMouseXPos = (UINT16)(uiXPos);
|
||||
gusMouseYPos = (UINT16)(uiYPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
gusMouseXPos = (UINT16)(uiXPos-rcClient.left);
|
||||
gusMouseYPos = (UINT16)(uiYPos-rcClient.top);
|
||||
}
|
||||
uiParam = (UINT32)gusMouseYPos<<16 | (UINT32)gusMouseXPos;
|
||||
|
||||
//Set that we have input
|
||||
gfSGPInputReceived = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( wParam == WM_MOUSEWHEEL )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
switch (wParam)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
gfLeftButtonState = TRUE;
|
||||
QueueEvent(LEFT_BUTTON_DOWN, 0, uiParam);
|
||||
break;
|
||||
case WM_LBUTTONUP:
|
||||
gfLeftButtonState = FALSE;
|
||||
QueueEvent(LEFT_BUTTON_UP, 0, uiParam);
|
||||
break;
|
||||
case WM_RBUTTONDOWN:
|
||||
gfRightButtonState = TRUE;
|
||||
QueueEvent(RIGHT_BUTTON_DOWN, 0, uiParam);
|
||||
break;
|
||||
case WM_RBUTTONUP:
|
||||
gfRightButtonState = FALSE;
|
||||
QueueEvent(RIGHT_BUTTON_UP, 0, uiParam);
|
||||
break;
|
||||
case WM_MOUSEMOVE:
|
||||
if(gfTrackMousePos)
|
||||
QueueEvent(MOUSE_POS, 0, uiParam);
|
||||
break;
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
BOOLEAN InitializeInputManager(void)
|
||||
{
|
||||
@@ -531,19 +350,25 @@ void QueueEvent(UINT16 ubInputEvent, UINT32 usParam, UINT32 uiParam)
|
||||
}
|
||||
|
||||
if (ubInputEvent == RIGHT_BUTTON_DOWN)
|
||||
{
|
||||
guiRightButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT;
|
||||
}
|
||||
if (ubInputEvent == MIDDLE_BUTTON_DOWN)
|
||||
guiMiddleButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT;
|
||||
if (ubInputEvent == X1_BUTTON_DOWN)
|
||||
guiX1ButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT;
|
||||
if (ubInputEvent == X2_BUTTON_DOWN)
|
||||
guiX2ButtonRepeatTimer = uiTimer + BUTTON_REPEAT_TIMEOUT;
|
||||
|
||||
if (ubInputEvent == LEFT_BUTTON_UP)
|
||||
{
|
||||
guiLeftButtonRepeatTimer = 0;
|
||||
}
|
||||
|
||||
if (ubInputEvent == RIGHT_BUTTON_UP)
|
||||
{
|
||||
guiRightButtonRepeatTimer = 0;
|
||||
}
|
||||
if (ubInputEvent == MIDDLE_BUTTON_UP)
|
||||
guiMiddleButtonRepeatTimer = 0;
|
||||
if (ubInputEvent == X1_BUTTON_UP)
|
||||
guiX1ButtonRepeatTimer = 0;
|
||||
if (ubInputEvent == X2_BUTTON_UP)
|
||||
guiX2ButtonRepeatTimer = 0;
|
||||
|
||||
|
||||
if ( (ubInputEvent == LEFT_BUTTON_UP) )
|
||||
{
|
||||
|
||||
@@ -18,9 +18,21 @@
|
||||
#define RIGHT_BUTTON_UP 0x0100
|
||||
#define RIGHT_BUTTON_REPEAT 0x0200
|
||||
#define MOUSE_POS 0x0400
|
||||
#define MOUSE_WHEEL 0x0800
|
||||
#define MIDDLE_BUTTON_UP 0x1000//dnl
|
||||
#define MIDDLE_BUTTON_DOWN 0x2000//dnl
|
||||
#define MOUSE_WHEEL 0x0800
|
||||
#define MOUSE_WHEEL_UP 0x0800
|
||||
#define MOUSE_WHEEL_DOWN 0x1000
|
||||
#define MIDDLE_BUTTON_DOWN 0x2000
|
||||
#define MIDDLE_BUTTON_UP 0x4000
|
||||
#define MIDDLE_BUTTON_REPEAT 0x8000
|
||||
#define X1_BUTTON_DOWN 0x8010
|
||||
#define X1_BUTTON_UP 0x8020
|
||||
#define X1_BUTTON_REPEAT 0x8030
|
||||
#define X2_BUTTON_DOWN 0x8040
|
||||
#define X2_BUTTON_UP 0x8050
|
||||
#define X2_BUTTON_REPEAT 0x8060
|
||||
//#define MIDDLE_BUTTON_UP 0x1000//dnl
|
||||
//#define MIDDLE_BUTTON_DOWN 0x2000//dnl
|
||||
|
||||
|
||||
#define SHIFT_DOWN 0x01
|
||||
#define CTRL_DOWN 0x02
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include "mousesystem.h"
|
||||
#include "Cursor Control.h"
|
||||
#include "Button System.h"
|
||||
///***ddd
|
||||
#include "GameSettings.h"
|
||||
#endif
|
||||
|
||||
#ifdef JA2_PRECOMPILED_HEADERS
|
||||
@@ -79,7 +81,8 @@ INT32 MSYS_CurrentID=MSYS_ID_SYSTEM;
|
||||
INT16 MSYS_CurrentMX=0;
|
||||
INT16 MSYS_CurrentMY=0;
|
||||
INT16 MSYS_CurrentButtons=0;
|
||||
INT16 MSYS_Action=0;
|
||||
INT16 MSYS_Action=MSYS_NO_ACTION;
|
||||
INT16 MSYS_Wheel=0;
|
||||
|
||||
BOOLEAN MSYS_SystemInitialized=FALSE;
|
||||
BOOLEAN MSYS_UseMouseHandlerHook=FALSE;
|
||||
@@ -114,7 +117,7 @@ void ExecuteMouseHelpEndCallBack( MOUSE_REGION *region );
|
||||
//values there as well. That's the only reason why I left this here.
|
||||
MOUSE_REGION MSYS_SystemBaseRegion = {
|
||||
MSYS_ID_SYSTEM, MSYS_PRIORITY_SYSTEM, BASE_REGION_FLAGS,
|
||||
-32767, -32767, 32767, 32767, 0, 0, 0, 0, 0, 0,
|
||||
-32767, -32767, 32767, 32767, 0, 0, 0, 0, 0, 0, 0,
|
||||
MSYS_NO_CALLBACK, MSYS_NO_CALLBACK, { 0,0,0,0 },
|
||||
0, 0, -1, MSYS_NO_CALLBACK, NULL, NULL };
|
||||
|
||||
@@ -158,6 +161,7 @@ INT32 MSYS_Init(void)
|
||||
MSYS_CurrentMX = 0;
|
||||
MSYS_CurrentMY = 0;
|
||||
MSYS_CurrentButtons = 0;
|
||||
MSYS_Wheel = 0;
|
||||
MSYS_Action=MSYS_NO_ACTION;
|
||||
|
||||
MSYS_PrevRegion = NULL;
|
||||
@@ -168,25 +172,26 @@ INT32 MSYS_Init(void)
|
||||
MSYS_GrabRegion = NULL;
|
||||
|
||||
// Setup the system's background region
|
||||
MSYS_SystemBaseRegion.IDNumber = MSYS_ID_SYSTEM;
|
||||
MSYS_SystemBaseRegion.PriorityLevel = MSYS_PRIORITY_SYSTEM;
|
||||
MSYS_SystemBaseRegion.uiFlags = BASE_REGION_FLAGS;
|
||||
MSYS_SystemBaseRegion.RegionTopLeftX = -32767;
|
||||
MSYS_SystemBaseRegion.RegionTopLeftY = -32767;
|
||||
MSYS_SystemBaseRegion.IDNumber = MSYS_ID_SYSTEM;
|
||||
MSYS_SystemBaseRegion.PriorityLevel = MSYS_PRIORITY_SYSTEM;
|
||||
MSYS_SystemBaseRegion.uiFlags = BASE_REGION_FLAGS;
|
||||
MSYS_SystemBaseRegion.RegionTopLeftX = -32767;
|
||||
MSYS_SystemBaseRegion.RegionTopLeftY = -32767;
|
||||
MSYS_SystemBaseRegion.RegionBottomRightX = 32767;
|
||||
MSYS_SystemBaseRegion.RegionBottomRightY = 32767;
|
||||
MSYS_SystemBaseRegion.MouseXPos = 0;
|
||||
MSYS_SystemBaseRegion.MouseYPos = 0;
|
||||
MSYS_SystemBaseRegion.RelativeXPos = 0;
|
||||
MSYS_SystemBaseRegion.RelativeYPos = 0;
|
||||
MSYS_SystemBaseRegion.ButtonState = 0;
|
||||
MSYS_SystemBaseRegion.Cursor = 0;
|
||||
MSYS_SystemBaseRegion.UserData[0] = 0;
|
||||
MSYS_SystemBaseRegion.UserData[1] = 0;
|
||||
MSYS_SystemBaseRegion.UserData[2] = 0;
|
||||
MSYS_SystemBaseRegion.UserData[3] = 0;
|
||||
MSYS_SystemBaseRegion.MouseXPos = 0;
|
||||
MSYS_SystemBaseRegion.MouseYPos = 0;
|
||||
MSYS_SystemBaseRegion.RelativeXPos = 0;
|
||||
MSYS_SystemBaseRegion.RelativeYPos = 0;
|
||||
MSYS_SystemBaseRegion.ButtonState = 0;
|
||||
MSYS_SystemBaseRegion.Cursor = 0;
|
||||
MSYS_SystemBaseRegion.WheelState = 0;
|
||||
MSYS_SystemBaseRegion.UserData[0] = 0;
|
||||
MSYS_SystemBaseRegion.UserData[1] = 0;
|
||||
MSYS_SystemBaseRegion.UserData[2] = 0;
|
||||
MSYS_SystemBaseRegion.UserData[3] = 0;
|
||||
MSYS_SystemBaseRegion.MovementCallback = MSYS_NO_CALLBACK;
|
||||
MSYS_SystemBaseRegion.ButtonCallback = MSYS_NO_CALLBACK;
|
||||
MSYS_SystemBaseRegion.ButtonCallback = MSYS_NO_CALLBACK;
|
||||
|
||||
MSYS_SystemBaseRegion.FastHelpTimer = 0;
|
||||
MSYS_SystemBaseRegion.FastHelpText = 0;
|
||||
@@ -204,7 +209,17 @@ INT32 MSYS_Init(void)
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
LONG WINAPI UEFilter(PEXCEPTION_POINTERS pEI)
|
||||
{
|
||||
MessageBox(NULL, ("Exception"), ("Oops !!!"), MB_ICONSTOP);
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
return -1;
|
||||
}
|
||||
SetUnhandledExceptionFilter(UEFilter);
|
||||
|
||||
*(char*)0 = 0;
|
||||
*/
|
||||
|
||||
|
||||
//======================================================================================================
|
||||
@@ -232,6 +247,8 @@ void MSYS_Shutdown(void)
|
||||
//
|
||||
void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLEAN LeftButton, BOOLEAN RightButton)
|
||||
{
|
||||
|
||||
|
||||
// If the mouse system isn't initialized, get out o' here
|
||||
if(!MSYS_SystemInitialized)
|
||||
return;
|
||||
@@ -240,6 +257,12 @@ void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLE
|
||||
if(!MSYS_UseMouseHandlerHook)
|
||||
return;
|
||||
|
||||
if(!gGameExternalOptions.fExtMouseKeyEnabled &&
|
||||
(Type == MIDDLE_BUTTON_UP || Type == MIDDLE_BUTTON_DOWN || Type == X1_BUTTON_DOWN ||
|
||||
Type == X1_BUTTON_UP || Type == X2_BUTTON_DOWN || Type == X2_BUTTON_UP || Type == X1_BUTTON_REPEAT ||
|
||||
Type == X2_BUTTON_REPEAT || Type == MOUSE_WHEEL_UP || Type == MOUSE_WHEEL_DOWN ) )
|
||||
return;
|
||||
|
||||
MSYS_Action=MSYS_NO_ACTION;
|
||||
switch(Type)
|
||||
{
|
||||
@@ -247,12 +270,23 @@ void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLE
|
||||
case LEFT_BUTTON_UP:
|
||||
case RIGHT_BUTTON_DOWN:
|
||||
case RIGHT_BUTTON_UP:
|
||||
case MIDDLE_BUTTON_UP:
|
||||
case MIDDLE_BUTTON_DOWN:
|
||||
case X1_BUTTON_DOWN:
|
||||
case X1_BUTTON_UP:
|
||||
case X2_BUTTON_DOWN:
|
||||
case X2_BUTTON_UP:
|
||||
|
||||
//MSYS_Action|=MSYS_DO_BUTTONS;
|
||||
if(Type == LEFT_BUTTON_DOWN)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_LBUTTON_DWN;
|
||||
MSYS_CurrentButtons|=MSYS_LEFT_BUTTON;
|
||||
}
|
||||
else if(Type == LEFT_BUTTON_UP)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_LBUTTON_UP;
|
||||
MSYS_CurrentButtons&=(~MSYS_LEFT_BUTTON);
|
||||
//Kris:
|
||||
//Used only if applicable. This is used for that special button that is locked with the
|
||||
//mouse press -- just like windows. When you release the button, the previous state
|
||||
@@ -265,9 +299,45 @@ void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLE
|
||||
#endif
|
||||
}
|
||||
else if(Type == RIGHT_BUTTON_DOWN)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_RBUTTON_DWN;
|
||||
MSYS_CurrentButtons|=MSYS_RIGHT_BUTTON;
|
||||
}
|
||||
else if(Type == RIGHT_BUTTON_UP)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_RBUTTON_UP;
|
||||
MSYS_CurrentButtons&=(~MSYS_RIGHT_BUTTON);
|
||||
}
|
||||
else if(Type == MIDDLE_BUTTON_DOWN)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_MBUTTON_DWN;
|
||||
MSYS_CurrentButtons|=MSYS_MIDDLE_BUTTON;
|
||||
}
|
||||
else if(Type == MIDDLE_BUTTON_UP)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_MBUTTON_UP;
|
||||
MSYS_CurrentButtons&=(~MSYS_MIDDLE_BUTTON);
|
||||
}
|
||||
else if(Type == X1_BUTTON_DOWN)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_X1BUTTON_DWN;
|
||||
MSYS_CurrentButtons|=MSYS_X1_BUTTON;
|
||||
}
|
||||
else if(Type == X1_BUTTON_UP)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_X1BUTTON_UP;
|
||||
MSYS_CurrentButtons&=(~MSYS_X1_BUTTON);
|
||||
}
|
||||
else if(Type == X2_BUTTON_DOWN)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_X2BUTTON_DWN;
|
||||
MSYS_CurrentButtons|=MSYS_X2_BUTTON;
|
||||
}
|
||||
else if(Type == X2_BUTTON_UP)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_X2BUTTON_UP;
|
||||
MSYS_CurrentButtons&=(~MSYS_X2_BUTTON);
|
||||
}
|
||||
|
||||
if(LeftButton)
|
||||
MSYS_CurrentButtons|=MSYS_LEFT_BUTTON;
|
||||
@@ -293,11 +363,20 @@ void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLE
|
||||
// Call mouse region with new reason
|
||||
case LEFT_BUTTON_REPEAT:
|
||||
case RIGHT_BUTTON_REPEAT:
|
||||
case MIDDLE_BUTTON_REPEAT:
|
||||
case X1_BUTTON_REPEAT:
|
||||
case X2_BUTTON_REPEAT:
|
||||
|
||||
if(Type == LEFT_BUTTON_REPEAT)
|
||||
MSYS_Action |= MSYS_DO_LBUTTON_REPEAT;
|
||||
else if(Type == RIGHT_BUTTON_REPEAT)
|
||||
MSYS_Action |= MSYS_DO_RBUTTON_REPEAT;
|
||||
else if(Type == MIDDLE_BUTTON_REPEAT)
|
||||
MSYS_Action |= MSYS_DO_MBUTTON_REPEAT;
|
||||
else if(Type == X1_BUTTON_REPEAT)
|
||||
MSYS_Action |= MSYS_DO_X1BUTTON_REPEAT;
|
||||
else if(Type == X2_BUTTON_REPEAT)
|
||||
MSYS_Action |= MSYS_DO_X2BUTTON_REPEAT;
|
||||
|
||||
if((Xcoord != MSYS_CurrentMX) || (Ycoord != MSYS_CurrentMY))
|
||||
{
|
||||
@@ -308,6 +387,20 @@ void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLE
|
||||
|
||||
MSYS_UpdateMouseRegion();
|
||||
break;
|
||||
case MOUSE_WHEEL_UP:
|
||||
case MOUSE_WHEEL_DOWN:
|
||||
if(Type == MOUSE_WHEEL_UP)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_WHEEL_UP;
|
||||
MSYS_Wheel++;
|
||||
}
|
||||
else if(Type == MOUSE_WHEEL_DOWN)
|
||||
{
|
||||
MSYS_Action |= MSYS_DO_WHEEL_DOWN;
|
||||
MSYS_Wheel--;
|
||||
}
|
||||
MSYS_UpdateMouseRegion();
|
||||
break;
|
||||
|
||||
case MOUSE_POS:
|
||||
if((Xcoord != MSYS_CurrentMX) || (Ycoord != MSYS_CurrentMY) || gfRefreshUpdate )
|
||||
@@ -326,6 +419,17 @@ void MSYS_SGP_Mouse_Handler_Hook(UINT16 Type,UINT16 Xcoord, UINT16 Ycoord, BOOLE
|
||||
DbgMessage(TOPIC_MOUSE_SYSTEM, DBG_LEVEL_0, "ERROR -- MSYS 2 SGP Mouse Hook got bad type");
|
||||
break;
|
||||
}
|
||||
// check for moved mouse
|
||||
if((Xcoord != MSYS_CurrentMX) || (Ycoord != MSYS_CurrentMY) || gfRefreshUpdate )
|
||||
{
|
||||
MSYS_Action|=MSYS_DO_MOVE;
|
||||
MSYS_CurrentMX = Xcoord;
|
||||
MSYS_CurrentMY = Ycoord;
|
||||
}
|
||||
|
||||
// update if something happened
|
||||
if (MSYS_Action != MSYS_NO_ACTION)
|
||||
MSYS_UpdateMouseRegion();
|
||||
}
|
||||
|
||||
|
||||
@@ -713,6 +817,8 @@ void MSYS_UpdateMouseRegion(void)
|
||||
MSYS_CurrRegion->RelativeYPos = MSYS_CurrentMY - MSYS_CurrRegion->RegionTopLeftY;
|
||||
|
||||
MSYS_CurrRegion->ButtonState = MSYS_CurrentButtons;
|
||||
MSYS_CurrRegion->WheelState = MSYS_Wheel;
|
||||
MSYS_Wheel = 0;
|
||||
|
||||
if( MSYS_CurrRegion->uiFlags & MSYS_REGION_ENABLED &&
|
||||
MSYS_CurrRegion->uiFlags & MSYS_MOVE_CALLBACK && MSYS_Action & MSYS_DO_MOVE )
|
||||
@@ -1080,7 +1186,7 @@ void MSYS_DisableRegion(MOUSE_REGION *region)
|
||||
//
|
||||
void MSYS_SetCurrentCursor(UINT16 Cursor)
|
||||
{
|
||||
TRYCATCH_RETHROW(SetCurrentCursorFromDatabase( Cursor ), "Could not set Cursor");
|
||||
SGP_TRYCATCH_RETHROW(SetCurrentCursorFromDatabase( Cursor ), "Could not set Cursor");
|
||||
}
|
||||
|
||||
|
||||
@@ -1746,3 +1852,8 @@ MOUSE_REGION *get_next_entry_in_MSYS_RegList(MOUSE_REGION *current_region)
|
||||
{
|
||||
return current_region->next;
|
||||
}
|
||||
|
||||
void ResetWheelState( MOUSE_REGION *region )
|
||||
{
|
||||
region->WheelState = 0;
|
||||
}
|
||||
@@ -35,22 +35,23 @@ typedef void (*MOUSE_CALLBACK)(struct _MOUSE_REGION *,INT32); // Define MOUSE_CA
|
||||
typedef void (*MOUSE_HELPTEXT_DONE_CALLBACK)( ); // the help is done callback
|
||||
|
||||
typedef struct _MOUSE_REGION {
|
||||
UINT16 IDNumber; // Region's ID number, set by mouse system
|
||||
INT8 PriorityLevel; // Region's Priority, set by system and/or caller
|
||||
UINT32 uiFlags; // Region's state flags
|
||||
INT16 RegionTopLeftX; // Screen area affected by this region (absolute coordinates)
|
||||
INT16 RegionTopLeftY;
|
||||
INT16 RegionBottomRightX;
|
||||
INT16 RegionBottomRightY;
|
||||
INT16 MouseXPos; // Mouse's Coordinates in absolute screen coordinates
|
||||
INT16 MouseYPos;
|
||||
INT16 RelativeXPos; // Mouse's Coordinates relative to the Top-Left corner of the region
|
||||
INT16 RelativeYPos;
|
||||
UINT16 ButtonState; // Current state of the mouse buttons
|
||||
UINT16 Cursor; // Cursor to use when mouse in this region (see flags)
|
||||
UINT16 IDNumber; // Region's ID number, set by mouse system
|
||||
INT8 PriorityLevel; // Region's Priority, set by system and/or caller
|
||||
UINT32 uiFlags; // Region's state flags
|
||||
INT16 RegionTopLeftX; // Screen area affected by this region (absolute coordinates)
|
||||
INT16 RegionTopLeftY;
|
||||
INT16 RegionBottomRightX;
|
||||
INT16 RegionBottomRightY;
|
||||
INT16 MouseXPos; // Mouse's Coordinates in absolute screen coordinates
|
||||
INT16 MouseYPos;
|
||||
INT16 RelativeXPos; // Mouse's Coordinates relative to the Top-Left corner of the region
|
||||
INT16 RelativeYPos;
|
||||
UINT16 ButtonState; // Current state of the mouse buttons
|
||||
INT16 WheelState; // Wheel state +/-number of wheel units
|
||||
UINT16 Cursor; // Cursor to use when mouse in this region (see flags)
|
||||
MOUSE_CALLBACK MovementCallback; // Pointer to callback function if movement occured in this region
|
||||
MOUSE_CALLBACK ButtonCallback; // Pointer to callback function if button action occured in this region
|
||||
INT32 UserData[4]; // User Data, can be set to anything!
|
||||
MOUSE_CALLBACK ButtonCallback; // Pointer to callback function if button action occured in this region
|
||||
INT32 UserData[4]; // User Data, can be set to anything!
|
||||
|
||||
//Fast help vars.
|
||||
INT16 FastHelpTimer; // Countdown timer for FastHelp text
|
||||
@@ -70,28 +71,28 @@ typedef struct _MOUSE_REGION {
|
||||
// *****************************************************************************
|
||||
|
||||
// Mouse Region Flags
|
||||
#define MSYS_NO_FLAGS 0x00000000
|
||||
#define MSYS_MOUSE_IN_AREA 0x00000001
|
||||
#define MSYS_SET_CURSOR 0x00000002
|
||||
#define MSYS_MOVE_CALLBACK 0x00000004
|
||||
#define MSYS_BUTTON_CALLBACK 0x00000008
|
||||
#define MSYS_REGION_EXISTS 0x00000010
|
||||
#define MSYS_SYSTEM_INIT 0x00000020
|
||||
#define MSYS_REGION_ENABLED 0x00000040
|
||||
#define MSYS_FASTHELP 0x00000080
|
||||
#define MSYS_GOT_BACKGROUND 0x00000100
|
||||
#define MSYS_HAS_BACKRECT 0x00000200
|
||||
#define MSYS_FASTHELP_RESET 0x00000400
|
||||
#define MSYS_NO_FLAGS 0x00000000
|
||||
#define MSYS_MOUSE_IN_AREA 0x00000001
|
||||
#define MSYS_SET_CURSOR 0x00000002
|
||||
#define MSYS_MOVE_CALLBACK 0x00000004
|
||||
#define MSYS_BUTTON_CALLBACK 0x00000008
|
||||
#define MSYS_REGION_EXISTS 0x00000010
|
||||
#define MSYS_SYSTEM_INIT 0x00000020
|
||||
#define MSYS_REGION_ENABLED 0x00000040
|
||||
#define MSYS_FASTHELP 0x00000080
|
||||
#define MSYS_GOT_BACKGROUND 0x00000100
|
||||
#define MSYS_HAS_BACKRECT 0x00000200
|
||||
#define MSYS_FASTHELP_RESET 0x00000400
|
||||
#define MSYS_ALLOW_DISABLED_FASTHELP 0x00000800
|
||||
|
||||
// Mouse region IDs
|
||||
#define MSYS_ID_BASE 1
|
||||
#define MSYS_ID_MAX 0xfffffff // ( INT32 max )
|
||||
#define MSYS_ID_BASE 1
|
||||
#define MSYS_ID_MAX 0xfffffff // ( INT32 max )
|
||||
#define MSYS_ID_SYSTEM 0
|
||||
|
||||
// Mouse region priorities
|
||||
#define MSYS_PRIORITY_LOWEST 0
|
||||
#define MSYS_PRIORITY_LOW 15
|
||||
#define MSYS_PRIORITY_LOW 15
|
||||
#define MSYS_PRIORITY_BASE 31
|
||||
#define MSYS_PRIORITY_NORMAL 31
|
||||
#define MSYS_PRIORITY_HIGH 63
|
||||
@@ -100,20 +101,43 @@ typedef struct _MOUSE_REGION {
|
||||
#define MSYS_PRIORITY_AUTO -1
|
||||
|
||||
// Mouse system defines used during updates
|
||||
#define MSYS_NO_ACTION 0
|
||||
#define MSYS_DO_MOVE 1
|
||||
#define MSYS_DO_LBUTTON_DWN 2
|
||||
#define MSYS_DO_LBUTTON_UP 4
|
||||
#define MSYS_DO_RBUTTON_DWN 8
|
||||
#define MSYS_DO_RBUTTON_UP 16
|
||||
#define MSYS_NO_ACTION 0
|
||||
#define MSYS_DO_MOVE 1
|
||||
#define MSYS_DO_LBUTTON_DWN 2
|
||||
#define MSYS_DO_LBUTTON_UP 4
|
||||
#define MSYS_DO_RBUTTON_DWN 8
|
||||
#define MSYS_DO_RBUTTON_UP 16
|
||||
#define MSYS_DO_LBUTTON_REPEAT 32
|
||||
#define MSYS_DO_RBUTTON_REPEAT 64
|
||||
#define MSYS_DO_MBUTTON_DWN 128
|
||||
#define MSYS_DO_MBUTTON_UP 256
|
||||
#define MSYS_DO_MBUTTON_REPEAT 512
|
||||
|
||||
#define MSYS_DO_BUTTONS (MSYS_DO_LBUTTON_DWN|MSYS_DO_LBUTTON_UP|MSYS_DO_RBUTTON_DWN|MSYS_DO_RBUTTON_UP|MSYS_DO_RBUTTON_REPEAT|MSYS_DO_LBUTTON_REPEAT)
|
||||
#define MSYS_DO_X1BUTTON_DWN 1024
|
||||
#define MSYS_DO_X1BUTTON_UP 2048
|
||||
#define MSYS_DO_X1BUTTON_REPEAT 4096
|
||||
#define MSYS_DO_X2BUTTON_DWN 8192
|
||||
#define MSYS_DO_X2BUTTON_UP 16384
|
||||
#define MSYS_DO_X2BUTTON_REPEAT 32768
|
||||
|
||||
#define MSYS_DO_WHEEL_UP 65536
|
||||
#define MSYS_DO_WHEEL_DOWN 131072
|
||||
|
||||
#define MSYS_DO_BUTTONS (MSYS_DO_LBUTTON_DWN|MSYS_DO_LBUTTON_UP|MSYS_DO_LBUTTON_REPEAT|\
|
||||
MSYS_DO_RBUTTON_DWN|MSYS_DO_RBUTTON_UP|MSYS_DO_RBUTTON_REPEAT|\
|
||||
MSYS_DO_MBUTTON_DWN|MSYS_DO_MBUTTON_UP|MSYS_DO_MBUTTON_REPEAT|\
|
||||
MSYS_DO_X1BUTTON_DWN|MSYS_DO_X1BUTTON_UP|MSYS_DO_X1BUTTON_REPEAT|\
|
||||
MSYS_DO_X2BUTTON_DWN|MSYS_DO_X2BUTTON_UP|MSYS_DO_X2BUTTON_REPEAT)
|
||||
|
||||
#define MSYS_DO_WHEEL (MSYS_DO_WHEEL_UP|MSYS_DO_WHEEL_DOWN)
|
||||
//#define MSYS_DO_BUTTONS (MSYS_DO_LBUTTON_DWN|MSYS_DO_LBUTTON_UP|MSYS_DO_RBUTTON_DWN|MSYS_DO_RBUTTON_UP|MSYS_DO_RBUTTON_REPEAT|MSYS_DO_LBUTTON_REPEAT)
|
||||
|
||||
// Mouse system button masks
|
||||
#define MSYS_LEFT_BUTTON 1
|
||||
#define MSYS_RIGHT_BUTTON 2
|
||||
#define MSYS_LEFT_BUTTON 1
|
||||
#define MSYS_RIGHT_BUTTON 2
|
||||
#define MSYS_MIDDLE_BUTTON 4
|
||||
#define MSYS_X1_BUTTON 8
|
||||
#define MSYS_X2_BUTTON 16
|
||||
|
||||
// Mouse system special values
|
||||
#define MSYS_NO_CALLBACK NULL
|
||||
@@ -127,8 +151,8 @@ typedef struct _MOUSE_REGION {
|
||||
#define MSYS_CALLBACK_REASON_LBUTTON_UP 8
|
||||
#define MSYS_CALLBACK_REASON_RBUTTON_DWN 16
|
||||
#define MSYS_CALLBACK_REASON_RBUTTON_UP 32
|
||||
#define MSYS_CALLBACK_REASON_BUTTONS (MSYS_CALLBACK_REASON_LBUTTON_DWN|MSYS_CALLBACK_REASON_LBUTTON_UP| \
|
||||
MSYS_CALLBACK_REASON_RBUTTON_DWN|MSYS_CALLBACK_REASON_RBUTTON_UP)
|
||||
//#define MSYS_CALLBACK_REASON_BUTTONS (MSYS_CALLBACK_REASON_LBUTTON_DWN|MSYS_CALLBACK_REASON_LBUTTON_UP| \
|
||||
// MSYS_CALLBACK_REASON_RBUTTON_DWN|MSYS_CALLBACK_REASON_RBUTTON_UP)
|
||||
#define MSYS_CALLBACK_REASON_LOST_MOUSE 64
|
||||
#define MSYS_CALLBACK_REASON_GAIN_MOUSE 128
|
||||
|
||||
@@ -142,6 +166,26 @@ typedef struct _MOUSE_REGION {
|
||||
//supports double clicks and single clicks, make sure the DOUBLECLICK event is checked first (rejecting
|
||||
//the LBUTTON_DWN event if detected)
|
||||
#define MSYS_CALLBACK_REASON_LBUTTON_DOUBLECLICK 1024
|
||||
#define MSYS_CALLBACK_REASON_MBUTTON_DWN 2048
|
||||
#define MSYS_CALLBACK_REASON_MBUTTON_UP 4096
|
||||
#define MSYS_CALLBACK_REASON_MBUTTON_REPEAT 8192
|
||||
#define MSYS_CALLBACK_REASON_WHEEL_UP 16384
|
||||
#define MSYS_CALLBACK_REASON_WHEEL_DOWN 32768
|
||||
#define MSYS_CALLBACK_REASON_X1BUTTON_DWN 65536
|
||||
#define MSYS_CALLBACK_REASON_X1BUTTON_UP 131072
|
||||
#define MSYS_CALLBACK_REASON_X1BUTTON_REPEAT 262144
|
||||
#define MSYS_CALLBACK_REASON_X2BUTTON_DWN 524288
|
||||
#define MSYS_CALLBACK_REASON_X2BUTTON_UP 1048576
|
||||
#define MSYS_CALLBACK_REASON_X2BUTTON_REPEAT 2097152
|
||||
|
||||
|
||||
#define MSYS_CALLBACK_REASON_BUTTONS (MSYS_CALLBACK_REASON_LBUTTON_DWN|MSYS_CALLBACK_REASON_LBUTTON_UP| \
|
||||
MSYS_CALLBACK_REASON_RBUTTON_DWN|MSYS_CALLBACK_REASON_RBUTTON_UP| \
|
||||
MSYS_CALLBACK_REASON_MBUTTON_DWN|MSYS_CALLBACK_REASON_MBUTTON_UP|\
|
||||
MSYS_CALLBACK_REASON_X1BUTTON_DWN|MSYS_CALLBACK_REASON_X1BUTTON_UP|\
|
||||
MSYS_CALLBACK_REASON_X2BUTTON_DWN|MSYS_CALLBACK_REASON_X2BUTTON_UP)
|
||||
|
||||
#define MSYS_CALLBACK_REASON_WHEEL (MSYS_CALLBACK_REASON_WHEEL_UP|MSYS_CALLBACK_REASON_WHEEL_DOWN)
|
||||
|
||||
|
||||
// Mouse grabbing return codes
|
||||
@@ -217,7 +261,7 @@ void EnableMouseFastHelp( void );
|
||||
void DisableMouseFastHelp( void );
|
||||
|
||||
void ResetClickedMode(void);
|
||||
|
||||
void ResetWheelState( MOUSE_REGION *region );
|
||||
#ifdef _JA2_RENDER_DIRTY
|
||||
|
||||
BOOLEAN SetRegionSavedRect( MOUSE_REGION *region);
|
||||
|
||||
@@ -0,0 +1,369 @@
|
||||
// __RAD16__ means 16 bit code (Win16)
|
||||
// __RAD32__ means 32 bit code (DOS, Win386, Win32s, Mac)
|
||||
|
||||
// __RADDOS__ means DOS code (16 or 32 bit)
|
||||
// __RADWIN__ means Windows code (Win16, Win386, Win32s)
|
||||
// __RADWINEXT__ means Windows 386 extender (Win386)
|
||||
// __RADNT__ means Win32s code
|
||||
// __RADMAC__ means Macintosh
|
||||
// __RADXBOX__ means the XBox console
|
||||
// __RADNGC__ means the Nintendo GameCube
|
||||
|
||||
// __RADX86__ means Intel x86
|
||||
// __RADMMX__ means Intel x86 MMX instructions are allowed
|
||||
// __RAD68K__ means 68K
|
||||
// __RADPPC__ means PowerPC
|
||||
|
||||
// __RADLITTLEENDIAN__ means processor is little-endian (x86)
|
||||
// __RADBIGENDIAN__ means processor is big-endian (680x0, PPC)
|
||||
|
||||
#ifndef __RADBASEH__
|
||||
#define __RADBASEH__
|
||||
|
||||
#if defined(GEKKO)
|
||||
|
||||
#define __RADNGC__
|
||||
#define __RAD32__
|
||||
#define __RADPPC__
|
||||
#define __RADBIGENDIAN__
|
||||
#define RADINLINE inline
|
||||
|
||||
#elif (defined(__MWERKS__) && !defined(__INTEL__)) || defined(__MRC__) || defined(THINK_C) || defined(powerc) || defined(macintosh) || defined(__powerc)
|
||||
|
||||
#define __RADMAC__
|
||||
#if defined(powerc) || defined(__powerc)
|
||||
#define __RADPPC__
|
||||
#else
|
||||
#define __RAD68K__
|
||||
#endif
|
||||
|
||||
#define __RAD32__
|
||||
#define __RADBIGENDIAN__
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#if (defined(__cplusplus) || ! __option(only_std_keywords))
|
||||
#define RADINLINE inline
|
||||
#endif
|
||||
#elif defined(__MRC__)
|
||||
#if defined(__cplusplus)
|
||||
#define RADINLINE inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#define __RADX86__
|
||||
#define __RADMMX__
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#define _WIN32
|
||||
#endif
|
||||
|
||||
#ifdef __DOS__
|
||||
#define __RADDOS__
|
||||
#endif
|
||||
|
||||
#ifdef __386__
|
||||
#define __RAD32__
|
||||
#endif
|
||||
|
||||
#ifdef _Windows //For Borland
|
||||
#ifdef __WIN32__
|
||||
#define WIN32
|
||||
#else
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS //For MS
|
||||
#ifndef _WIN32
|
||||
#define __WINDOWS__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _XBOX
|
||||
#define __RADXBOX__
|
||||
#else
|
||||
#define __RADNT__
|
||||
#endif
|
||||
#define __RADWIN__
|
||||
#define __RAD32__
|
||||
#else
|
||||
#ifdef __NT__
|
||||
#ifdef _XBOX
|
||||
#define __RADXBOX__
|
||||
#else
|
||||
#define __RADNT__
|
||||
#endif
|
||||
#define __RADWIN__
|
||||
#define __RAD32__
|
||||
#else
|
||||
#ifdef __WINDOWS_386__
|
||||
#define __RADWIN__
|
||||
#define __RADWINEXT__
|
||||
#define __RAD32__
|
||||
#else
|
||||
#ifdef __WINDOWS__
|
||||
#define __RADWIN__
|
||||
#define __RAD16__
|
||||
#else
|
||||
#ifdef WIN32
|
||||
#ifdef _XBOX
|
||||
#define __RADXBOX__
|
||||
#else
|
||||
#define __RADNT__
|
||||
#endif
|
||||
#define __RADWIN__
|
||||
#define __RAD32__
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define __RADLITTLEENDIAN__
|
||||
#define RADINLINE __inline
|
||||
#endif
|
||||
|
||||
#if (!defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) && !defined(__RADNGC__) && !defined(__RADXBOX__))
|
||||
#error "RAD.H did not detect your platform. Define __DOS__, __WINDOWS__, WIN32, macintosh, or powerc."
|
||||
#endif
|
||||
|
||||
#ifdef __RADFINAL__
|
||||
#define RADTODO(str) { char __str[0]=str; }
|
||||
#else
|
||||
#define RADTODO(str)
|
||||
#endif
|
||||
|
||||
#ifdef __RADNGC__
|
||||
|
||||
#define RADLINK
|
||||
#define RADEXPLINK
|
||||
#define RADEXPFUNC RADDEFFUNC
|
||||
#define RADASMLINK
|
||||
#define PTR4
|
||||
|
||||
#elif defined(__RADMAC__)
|
||||
|
||||
// this define is for CodeWarrior 11's stupid new libs (even though
|
||||
// we don't use longlong's).
|
||||
|
||||
#define __MSL_LONGLONG_SUPPORT__
|
||||
|
||||
#define RADLINK
|
||||
#define RADEXPLINK
|
||||
|
||||
#ifdef __CFM68K__
|
||||
#ifdef __RADINDLL__
|
||||
#define RADEXPFUNC RADDEFFUNC __declspec(export)
|
||||
#else
|
||||
#define RADEXPFUNC RADDEFFUNC __declspec(import)
|
||||
#endif
|
||||
#else
|
||||
#define RADEXPFUNC RADDEFFUNC
|
||||
#endif
|
||||
#define RADASMLINK
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __RADNT__
|
||||
#ifndef _WIN32
|
||||
#define _WIN32
|
||||
#endif
|
||||
#ifndef WIN32
|
||||
#define WIN32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __RADWIN__
|
||||
#ifdef __RAD32__
|
||||
#ifdef __RADXBOX__
|
||||
|
||||
#define RADLINK __stdcall
|
||||
#define RADEXPLINK __stdcall
|
||||
#define RADEXPFUNC RADDEFFUNC
|
||||
|
||||
#else
|
||||
#ifdef __RADNT__
|
||||
|
||||
#define RADLINK __stdcall
|
||||
#define RADEXPLINK __stdcall
|
||||
|
||||
#ifdef __RADINEXE__
|
||||
#define RADEXPFUNC RADDEFFUNC
|
||||
#else
|
||||
#ifndef __RADINDLL__
|
||||
#define RADEXPFUNC RADDEFFUNC __declspec(dllimport)
|
||||
#ifdef __BORLANDC__
|
||||
#if __BORLANDC__<=0x460
|
||||
#undef RADEXPFUNC
|
||||
#define RADEXPFUNC RADDEFFUNC
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define RADEXPFUNC RADDEFFUNC __declspec(dllexport)
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define RADLINK __pascal
|
||||
#define RADEXPLINK __far __pascal
|
||||
#define RADEXPFUNC RADDEFFUNC
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#define RADLINK __pascal
|
||||
#define RADEXPLINK __far __pascal __export
|
||||
#define RADEXPFUNC RADDEFFUNC
|
||||
#endif
|
||||
#else
|
||||
#define RADLINK __pascal
|
||||
#define RADEXPLINK __pascal
|
||||
#define RADEXPFUNC RADDEFFUNC
|
||||
#endif
|
||||
|
||||
#define RADASMLINK __cdecl
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __RADXBOX__
|
||||
#ifdef __RADWIN__
|
||||
#ifndef _WINDOWS
|
||||
#define _WINDOWS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RADDEFFUNC
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define RADDEFFUNC extern "C"
|
||||
#define RADDEFSTART extern "C" {
|
||||
#define RADDEFEND }
|
||||
#define RADDEFINEDATA extern "C"
|
||||
#define RADDECLAREDATA extern "C"
|
||||
#define RADDEFAULT( val ) =val
|
||||
#else
|
||||
#define RADDEFFUNC
|
||||
#define RADDEFSTART
|
||||
#define RADDEFEND
|
||||
#define RADDEFINEDATA
|
||||
#define RADDECLAREDATA extern
|
||||
#define RADDEFAULT( val )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __RADNGC__
|
||||
#define RAD_ATTRIBUTE_ALIGN(num) __attribute__ ((aligned (num)))
|
||||
#else
|
||||
#ifdef __RADX86__
|
||||
#define RAD_ATTRIBUTE_ALIGN(num) __declspec(align(num))
|
||||
#else
|
||||
#define RAD_ATTRIBUTE_ALIGN(num)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __RADX86__
|
||||
#ifdef __WATCOMC__
|
||||
#define RAD_ALIGN_TYPE double
|
||||
#define RAD_ALIGN_DEF 0.0
|
||||
#else
|
||||
#define RAD_ALIGN_TYPE double __declspec(align(8))
|
||||
#define RAD_ALIGN_DEF 0.0
|
||||
#endif
|
||||
#else
|
||||
#define RAD_ALIGN_TYPE double
|
||||
#define RAD_ALIGN_DEF 0.0
|
||||
#endif
|
||||
|
||||
#define RAD_ALIGN_ADD_TYPE(var) RAD_ALIGN_TYPE var##align = RAD_ALIGN_DEF
|
||||
|
||||
#define S8 signed char
|
||||
#define U8 unsigned char
|
||||
#define U32 unsigned long
|
||||
#define S32 signed long
|
||||
#define F32 float
|
||||
#define F64 double
|
||||
|
||||
#if defined(__MWERKS__) || defined(__MRC__) || defined( GEKKO )
|
||||
#define U64 unsigned long long
|
||||
#define S64 signed long long
|
||||
#else
|
||||
#define U64 unsigned __int64
|
||||
#define S64 signed __int64
|
||||
#endif
|
||||
|
||||
#ifdef __RAD32__
|
||||
#define PTR4
|
||||
#define U16 unsigned short
|
||||
#define S16 signed short
|
||||
#else
|
||||
#define PTR4 __far
|
||||
#define U16 unsigned int
|
||||
#define S16 signed int
|
||||
#endif
|
||||
|
||||
#ifndef RAD_NO_LOWERCASE_TYPES
|
||||
|
||||
#ifdef __RADNGC__
|
||||
|
||||
// Unfortunately dolphin\types.h typedefs the
|
||||
// same types that we use.
|
||||
// So we use the typedefs for this platform.
|
||||
|
||||
#include <dolphin\types.h>
|
||||
|
||||
#else
|
||||
|
||||
#ifndef u8
|
||||
#define u8 U8
|
||||
#endif
|
||||
#ifndef s8
|
||||
#define s8 S8
|
||||
#endif
|
||||
#ifndef u16
|
||||
#define u16 U16
|
||||
#endif
|
||||
#ifndef s16
|
||||
#define s16 S16
|
||||
#endif
|
||||
#ifndef u32
|
||||
#define u32 U32
|
||||
#endif
|
||||
#ifndef s32
|
||||
#define s32 S32
|
||||
#endif
|
||||
#ifndef u64
|
||||
#define u64 U64
|
||||
#endif
|
||||
#ifndef s64
|
||||
#define s64 S64
|
||||
#endif
|
||||
#ifndef f32
|
||||
#define f32 F32
|
||||
#endif
|
||||
#ifndef f64
|
||||
#define f64 F64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef radassert
|
||||
#if defined(_DEBUG) && !defined(NDEBUG)
|
||||
#ifdef __RADNGC__
|
||||
#define radassert( cond ) { if (!(cond)) { OSReport("Assert: %s File: %s Line %i\n",#cond,__FILE__, __LINE__); BreakPoint(); } }
|
||||
#else
|
||||
#define radassert( cond ) { if (!(cond)) BreakPoint(); }
|
||||
#endif
|
||||
#else
|
||||
#define radassert( cond )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef void PTR4* (RADLINK PTR4* RADMEMALLOC) (U32 bytes);
|
||||
typedef void (RADLINK PTR4* RADMEMFREE) (void PTR4* ptr);
|
||||
|
||||
#endif
|
||||
+235
-152
@@ -37,15 +37,20 @@
|
||||
#include "input.h"
|
||||
#include "zmouse.h"
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_init.h"
|
||||
#include "VFS/File/vfs_file.h"
|
||||
#include "VFS/Location/vfs_slf_library.h"
|
||||
#include "VFS/Tools/Log.h"
|
||||
#include "VFS/Tools/ParserTools.h"
|
||||
#include <vfs/Aspects/vfs_settings.h>
|
||||
#include <vfs/Core/vfs.h>
|
||||
#include <vfs/Core/vfs_init.h>
|
||||
#include <vfs/Core/vfs_os_functions.h>
|
||||
#include <vfs/Core/File/vfs_file.h>
|
||||
#include <vfs/Tools/vfs_log.h>
|
||||
#include <vfs/Tools/vfs_parser_tools.h>
|
||||
#include <vfs/Tools/vfs_file_logger.h>
|
||||
|
||||
#include "sgp_logger.h"
|
||||
#include "Text.h"
|
||||
#include "VFS/os_functions.h"
|
||||
#include "VFS/vfs_settings.h"
|
||||
#include "LocalizedStrings.h"
|
||||
#include "ExportStrings.h"
|
||||
#include "ImportStrings.h"
|
||||
|
||||
#define USE_CONSOLE 0
|
||||
|
||||
@@ -79,17 +84,53 @@ static std::list<vfs::Path> vfs_config_ini;
|
||||
static bool s_DebugKeyboardInput = false;
|
||||
static vfs::Path s_CodePage;
|
||||
|
||||
void SHOWEXCEPTION(CBasicException& ex)
|
||||
static vfs::FileLogger *vfslog = NULL;
|
||||
|
||||
void SHOWEXCEPTION(sgp::Exception& ex)
|
||||
{
|
||||
try {
|
||||
_ExceptionMessage(ex);
|
||||
}
|
||||
catch(CBasicException &ex2) {
|
||||
logException(ex2);
|
||||
catch(sgp::Exception &ex2) {
|
||||
SGP_ERROR(ex2.what());
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void SHOWEXCEPTION(vfs::Exception& ex)
|
||||
{
|
||||
try {
|
||||
_ExceptionMessage(ex);
|
||||
}
|
||||
catch(vfs::Exception &ex2) {
|
||||
SGP_ERROR(ex2.what());
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
#define HANDLE_FATAL_ERROR \
|
||||
catch(sgp::Exception &ex){ \
|
||||
SGP_ERROR(ex.what()); \
|
||||
FatalError((const STR8)ex.what()); \
|
||||
exit(0); } \
|
||||
catch(vfs::Exception &ex){ \
|
||||
SGP_ERROR(ex.what()); \
|
||||
FatalError((const STR8)ex.getExceptionString().utf8().c_str()); \
|
||||
exit(0); } \
|
||||
catch(std::exception &ex){ \
|
||||
SGP_ERROR(ex.what()); \
|
||||
FatalError((const STR8)ex.what()); \
|
||||
exit(0); } \
|
||||
catch(const char* msg){ \
|
||||
SGP_ERROR(msg); \
|
||||
FatalError((const STR8)msg); \
|
||||
exit(0); } \
|
||||
catch(...){ \
|
||||
SGP_ERROR("Caught undefined exception"); \
|
||||
FatalError("Caught undefined exception"); \
|
||||
exit(0); }
|
||||
|
||||
|
||||
extern UINT32 MemDebugCounter;
|
||||
#ifdef JA2
|
||||
extern BOOLEAN gfPauseDueToPlayerGamePause;
|
||||
@@ -159,6 +200,15 @@ BOOLEAN gfIgnoreMessages=FALSE;
|
||||
// GLOBAL VARIBLE, SET TO DEFAULT BUT CAN BE CHANGED BY THE GAME IF INIT FILE READ
|
||||
UINT8 gbPixelDepth = PIXEL_DEPTH;
|
||||
|
||||
bool s_bExportStrings = false;
|
||||
extern bool g_bUseXML_Strings;// = false;
|
||||
bool g_bUseXML_Structures = false;
|
||||
bool g_bUseXML_Tilesets = false;
|
||||
|
||||
#ifdef USE_VFS
|
||||
static vfs::Path sp_force_load_jsd_xml_file;
|
||||
#endif
|
||||
|
||||
INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static BOOLEAN fRestore = FALSE;
|
||||
@@ -174,11 +224,14 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
return(DefWindowProc(hWindow, Message, wParam, lParam));
|
||||
|
||||
// ATE: This is for older win95 or NT 3.51 to get MOUSE_WHEEL Messages
|
||||
if ( Message == guiMouseWheelMsg )
|
||||
{
|
||||
QueueEvent(MOUSE_WHEEL, wParam, lParam);
|
||||
return( 0L );
|
||||
}
|
||||
//if ( Message == guiMouseWheelMsg )
|
||||
//{
|
||||
// QueueEvent(MOUSE_WHEEL, wParam, lParam);
|
||||
// return( 0L );
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
switch(Message)
|
||||
{
|
||||
@@ -186,11 +239,11 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
/*dnl kick this out, because in input.sgp MouseHandler() hook has priority so it will process same event twice, someone force MouseHandler() hook to always return unhandled events status so what ever mouse event you process in WindowProcedure() be aware that this event is already occur in MouseHandler() (mouse clicks, move etc.) Probably this is done because when you lost focus even if you click back on window region this will not restore them, so need condition in MouseHandler to restore window focus
|
||||
case WM_MOUSEWHEEL:
|
||||
{
|
||||
QueueEvent(MOUSE_WHEEL, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
// case WM_MOUSEWHEEL:
|
||||
// {
|
||||
// QueueEvent(MOUSE_WHEEL, wParam, lParam);
|
||||
// break;
|
||||
// }
|
||||
*/
|
||||
#ifdef JA2
|
||||
case WM_MOVE:
|
||||
@@ -526,9 +579,9 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
#ifdef USE_CODE_PAGE
|
||||
if(s_DebugKeyboardInput)
|
||||
{
|
||||
static CLog& debugKeys = *CLog::Create(L"DebugKeys.txt");
|
||||
static vfs::Log& debugKeys = *vfs::Log::Create(L"DebugKeys.txt");
|
||||
static int input_counter = 1;
|
||||
debugKeys << (input_counter++) << " : " << (int)wParam << CLog::endl;
|
||||
debugKeys << (input_counter++) << " : " << (int)wParam << vfs::Log::endl;
|
||||
}
|
||||
#endif // USE_CODE_PAGE
|
||||
KeyDown(wParam, lParam);
|
||||
@@ -594,32 +647,7 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
#endif
|
||||
|
||||
// Second, read in settings
|
||||
std::list<CBasicException> exlist;
|
||||
try
|
||||
{
|
||||
GetRuntimeSettings( );
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
{
|
||||
logException(ex);
|
||||
// nothing is set up, no vfs, no video manager
|
||||
// regular error processing wouldn't work here
|
||||
// set default values and continue as if nothing has happened
|
||||
iResolution = 1;
|
||||
|
||||
gbPixelDepth = PIXEL_DEPTH;
|
||||
|
||||
SCREEN_WIDTH = 800;
|
||||
SCREEN_HEIGHT = 600;
|
||||
|
||||
iScreenWidthOffset = (SCREEN_WIDTH - 640) / 2;
|
||||
iScreenHeightOffset = (SCREEN_HEIGHT - 480) / 2;
|
||||
|
||||
iScreenMode = 1;
|
||||
iPlayIntro = 0;
|
||||
// rethrow exception after full setup
|
||||
exlist.push_back(ex);
|
||||
}
|
||||
GetRuntimeSettings( );
|
||||
|
||||
// Initialize the Debug Manager - success doesn't matter
|
||||
InitializeDebugManager();
|
||||
@@ -698,13 +726,14 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
//InitializeJA2TimerID();
|
||||
|
||||
#ifdef USE_VFS
|
||||
vfs::Path exe_dir, exe_file;
|
||||
os::getExecutablePath(exe_dir, exe_file);
|
||||
//vfs::Path exe_dir, exe_file;
|
||||
//os::getExecutablePath(exe_dir, exe_file);
|
||||
|
||||
// set current directory to exe's directory
|
||||
os::setCurrectDirectory(exe_dir);
|
||||
//// set current directory to exe's directory
|
||||
//os::setCurrectDirectory(exe_dir);
|
||||
|
||||
SGP_THROW_IFFALSE( vfs_init::initVirtualFileSystem( vfs_config_ini ), L"Initializing Virtual File System failed");
|
||||
|
||||
THROWIFFALSE( initVirtualFileSystem( vfs_config_ini ), L"Initializing Virtual File System failed");
|
||||
|
||||
s_VfsIsInitialized = true;
|
||||
|
||||
@@ -713,6 +742,19 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
getVFS()->getVirtualLocation(vfs::Path(pMessageStrings[MSG_SAVEDIRECTORY]+3),true)->setIsExclusive(true);
|
||||
getVFS()->getVirtualLocation(vfs::Path(pMessageStrings[MSG_MPSAVEDIRECTORY]+3),true)->setIsExclusive(true);
|
||||
|
||||
if(!sp_force_load_jsd_xml_file.empty())
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string filename = vfs::String::as_utf8(sp_force_load_jsd_xml_file());
|
||||
STRUCTURE_FILE_REF *pStructureFileRef = LoadStructureFile((STR8)filename.c_str());
|
||||
}
|
||||
catch(std::exception &ex)
|
||||
{
|
||||
SGP_RETHROW(_BS(L"failed to load and/or process file : ") << sp_force_load_jsd_xml_file << _BS::wget, ex);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_CODE_PAGE
|
||||
charSet::InitializeCharSets();
|
||||
|
||||
@@ -723,11 +765,11 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
CodePageReader cpr;
|
||||
cpr.ReadCodePage(s_CodePage);
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(std::exception& ex)
|
||||
{
|
||||
std::wstringstream wss;
|
||||
wss << L"Could not process codepage file \"" << s_CodePage() << L"\"";
|
||||
RETHROWEXCEPTION(wss.str().c_str(), &ex);
|
||||
SGP_RETHROW(wss.str().c_str(), ex);
|
||||
}
|
||||
}
|
||||
#endif // USE_CODE_PAGE
|
||||
@@ -762,6 +804,16 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
gCustomDataCat.NewCat(std::string(CurrentDir) + '\\' + customDataPath);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(g_bUseXML_Strings)
|
||||
{
|
||||
if(s_bExportStrings)
|
||||
{
|
||||
Loc::ExportStrings();
|
||||
}
|
||||
Loc::ImportStrings();
|
||||
}
|
||||
|
||||
//#ifdef JA2
|
||||
InitJA2SplashScreen();
|
||||
//#endif
|
||||
@@ -813,10 +865,6 @@ BOOLEAN InitializeStandardGamingPlatform(HINSTANCE hInstance, int sCommandShow)
|
||||
|
||||
gfGameInitialized = TRUE;
|
||||
|
||||
if(!exlist.empty())
|
||||
{
|
||||
RETHROWEXCEPTION(L"Error during reading runtime settings", &exlist.front());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -893,17 +941,19 @@ void ShutdownStandardGamingPlatform(void)
|
||||
|
||||
ShutdownDebugManager();
|
||||
|
||||
CLog::flushFinally();
|
||||
sgp::Logger::instance().shutdown();
|
||||
vfs::Log::flushDeleteAll();
|
||||
if(vfslog) delete vfslog;
|
||||
vfs::CVirtualFileSystem::shutdownVFS();
|
||||
CFileAllocator::clear();
|
||||
vfs::ObjectAllocator::clear();
|
||||
}
|
||||
|
||||
#ifdef USE_VFS
|
||||
#include "MPJoinScreen.h"
|
||||
|
||||
utf8string getGameID()
|
||||
vfs::String getGameID()
|
||||
{
|
||||
static utf8string _id;
|
||||
static vfs::String _id;
|
||||
static bool has_id = false;
|
||||
if(!has_id)
|
||||
{
|
||||
@@ -914,6 +964,58 @@ utf8string getGameID()
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "debug_util.h"
|
||||
#include <vfs/Aspects/vfs_logging.h>
|
||||
|
||||
class VfsLogAdapter : public vfs::Aspects::ILogger
|
||||
{
|
||||
public:
|
||||
VfsLogAdapter(sgp::Logger_ID ID, bool stacktrace = false) : _id(ID), _trace(stacktrace) {};
|
||||
|
||||
virtual void Msg(const wchar_t* msg)
|
||||
{
|
||||
SGP_LOG(_id, msg);
|
||||
if(_trace)
|
||||
{
|
||||
sgp::dumpStackTrace(msg);
|
||||
}
|
||||
}
|
||||
virtual void Msg(const char* msg)
|
||||
{
|
||||
SGP_LOG(_id, msg);
|
||||
if(_trace)
|
||||
{
|
||||
sgp::dumpStackTrace(msg);
|
||||
}
|
||||
}
|
||||
private:
|
||||
sgp::Logger_ID _id;
|
||||
bool _trace;
|
||||
};
|
||||
|
||||
//#include <vfs/Aspects/vfs_synchronization.h>
|
||||
//#include "sgp_mutex.h"
|
||||
//class VfsMutex : public vfs::Aspects::IMutex
|
||||
//{
|
||||
//public:
|
||||
// virtual void lock(){
|
||||
// _mutex.lock();
|
||||
// }
|
||||
// virtual void unlock(){
|
||||
// _mutex.unlock();
|
||||
// }
|
||||
//private:
|
||||
// sgp::Mutex _mutex;
|
||||
//};
|
||||
//class VfsMutexFactory : public vfs::Aspects::IMutexFactory
|
||||
//{
|
||||
//public:
|
||||
// virtual vfs::Aspects::IMutex* createMutex()
|
||||
// {
|
||||
// return new VfsMutex();
|
||||
// }
|
||||
//};
|
||||
|
||||
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCommandLine, int sCommandShow)
|
||||
{
|
||||
|
||||
@@ -951,6 +1053,22 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
HWND hPrevInstanceWindow;
|
||||
UINT32 uiTimer = 0;
|
||||
|
||||
#ifdef USE_VFS
|
||||
vfs::Log::setSharedString( getGameID() );
|
||||
#endif
|
||||
//if(!vfs::Aspects::getMutexFactory())
|
||||
//{
|
||||
// vfs::Aspects::setMutexFactory( new VfsMutexFactory() );
|
||||
//}
|
||||
sgp::Logger_ID VFS_LOG = sgp::Logger::instance().createLogger();
|
||||
|
||||
sgp::Logger::instance().connectFile(VFS_LOG, L"vfs.log", false, sgp::Logger::FLUSH_ON_DELETE);
|
||||
|
||||
VfsLogAdapter* vfslog = new VfsLogAdapter(VFS_LOG, false);
|
||||
VfsLogAdapter* vfslog_error = new VfsLogAdapter(VFS_LOG, true);
|
||||
|
||||
vfs::Aspects::setLogger(vfslog, vfslog, vfslog_error, NULL /* vfslog */);
|
||||
|
||||
// Make sure that only one instance of this application is running at once
|
||||
// // Look for prev instance by searching for the window
|
||||
hPrevInstanceWindow = FindWindowEx( NULL, NULL, APPLICATION_NAME, APPLICATION_NAME );
|
||||
@@ -967,10 +1085,6 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
// Initialize random number generator
|
||||
InitializeRandom(); // no Shutdown
|
||||
|
||||
#ifdef USE_VFS
|
||||
CLog::setSharedString( getGameID() );
|
||||
#endif
|
||||
|
||||
//rain
|
||||
//NSLoadSettings();
|
||||
//NSSaveSettings();
|
||||
@@ -1029,9 +1143,9 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
// ShowCursor(FALSE);
|
||||
|
||||
#ifdef USE_VFS
|
||||
vfs::Path exe_dir, exe_file;
|
||||
os::getExecutablePath(exe_dir, exe_file);
|
||||
os::setCurrectDirectory(exe_dir);
|
||||
//vfs::Path exe_dir, exe_file;
|
||||
//os::getExecutablePath(exe_dir, exe_file);
|
||||
//os::setCurrectDirectory(exe_dir);
|
||||
#else
|
||||
STRING512 sExecutableDir;
|
||||
GetExecutableDirectory( sExecutableDir );
|
||||
@@ -1046,65 +1160,11 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch(CBasicException &ex)
|
||||
{
|
||||
if(!s_VfsIsInitialized)
|
||||
{
|
||||
vfs::CFile* fonts = new vfs::CFile("Data/Fonts.slf");
|
||||
vfs::CSLFLibrary* slfLib = new vfs::CSLFLibrary(vfs::tReadableFile::cast(fonts),"");
|
||||
if(slfLib->init())
|
||||
{
|
||||
getVFS()->addLocation(slfLib,"doesn't matter");
|
||||
}
|
||||
// fonts not initialized
|
||||
FontTranslationTable *pFontTable = CreateEnglishTransTable( );
|
||||
if ( pFontTable == NULL )
|
||||
{
|
||||
return( FALSE );
|
||||
}
|
||||
HANDLE_FATAL_ERROR;
|
||||
|
||||
// Initialize Font Manager
|
||||
FastDebugMsg("Initializing the Font Manager");
|
||||
// Init the manager and copy the TransTable stuff into it.
|
||||
if ( !InitializeFontManager( 8, pFontTable ) )
|
||||
{
|
||||
FastDebugMsg("FAILED : Initializing Font Manager");
|
||||
return FALSE;
|
||||
}
|
||||
// Don't need this thing anymore, so get rid of it (but don't de-alloc the contents)
|
||||
MemFree( pFontTable );
|
||||
if ( !InitializeFonts( ) )
|
||||
{
|
||||
// Send debug message and quit
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "COULD NOT INUT FONT SYSTEM...");
|
||||
return( ERROR_SCREEN );
|
||||
}
|
||||
}
|
||||
gfProgramIsRunning = 1;
|
||||
logException(ex);
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(std::exception &ex)
|
||||
{
|
||||
gfProgramIsRunning = 1;
|
||||
CBasicException nex(ex.what(),_FUNCTION_FORMAT_,__LINE__,__FILE__);
|
||||
logException(nex);
|
||||
SHOWEXCEPTION(nex);
|
||||
}
|
||||
catch(const char* msg)
|
||||
{
|
||||
gfProgramIsRunning = 1;
|
||||
CBasicException ex(msg,_FUNCTION_FORMAT_,__LINE__,__FILE__);
|
||||
logException(ex);
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
gfProgramIsRunning = 1;
|
||||
CBasicException ex("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__);
|
||||
logException( ex );
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
#ifdef USE_VFS
|
||||
vfs::Log::flushReleaseAll();
|
||||
#endif
|
||||
|
||||
#ifdef LUACONSOLE
|
||||
if (1==iScreenMode)
|
||||
@@ -1114,9 +1174,13 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
#endif
|
||||
|
||||
#ifdef JA2
|
||||
#ifdef ENGLISH
|
||||
# ifdef ENGLISH
|
||||
try
|
||||
{
|
||||
SetIntroType( INTRO_SPLASH );
|
||||
#endif
|
||||
}
|
||||
HANDLE_FATAL_ERROR;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
gfApplicationActive = TRUE;
|
||||
@@ -1146,27 +1210,32 @@ int PASCAL HandledWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pC
|
||||
DispatchMessage(&Message);
|
||||
}
|
||||
}
|
||||
catch(CBasicException &ex)
|
||||
catch(sgp::Exception &ex)
|
||||
{
|
||||
logException(ex);
|
||||
SGP_ERROR(ex.what());
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(vfs::Exception &ex)
|
||||
{
|
||||
SGP_ERROR(ex.what());
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(std::exception &ex)
|
||||
{
|
||||
CBasicException nex(ex.what(),_FUNCTION_FORMAT_,__LINE__,__FILE__);
|
||||
logException(nex);
|
||||
sgp::Exception nex(ex.what());
|
||||
SGP_ERROR(nex.what());
|
||||
SHOWEXCEPTION(nex);
|
||||
}
|
||||
catch(const char* msg)
|
||||
{
|
||||
CBasicException ex(msg,_FUNCTION_FORMAT_,__LINE__,__FILE__);
|
||||
logException(ex);
|
||||
sgp::Exception ex(msg);
|
||||
SGP_ERROR(ex.what());
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
CBasicException ex("Caught undefined exception", _FUNCTION_FORMAT_, __LINE__, __FILE__);
|
||||
logException( ex );
|
||||
sgp::Exception ex("Caught undefined exception");
|
||||
SGP_ERROR( ex.what() );
|
||||
SHOWEXCEPTION(ex);
|
||||
}
|
||||
|
||||
@@ -1262,7 +1331,7 @@ void GetRuntimeSettings( )
|
||||
|
||||
strcat(INIFile, "\\Ja2.ini");
|
||||
#else
|
||||
CPropertyContainer oProps;
|
||||
vfs::PropertyContainer oProps;
|
||||
oProps.initFromIniFile("Ja2.ini");
|
||||
#endif
|
||||
iResolution = -1;
|
||||
@@ -1272,24 +1341,24 @@ void GetRuntimeSettings( )
|
||||
iResolution = atoi(zScreenResolution);
|
||||
}
|
||||
#else
|
||||
utf8string loc = oProps.getStringProperty("Ja2 Settings", L"LOCALE");
|
||||
vfs::String loc = oProps.getStringProperty("Ja2 Settings", L"LOCALE");
|
||||
if(!loc.empty())
|
||||
{
|
||||
THROWIFFALSE( setlocale(LC_ALL, loc.utf8().c_str()), BuildString().add(L"invalid locale : ").add(loc).get());
|
||||
SGP_THROW_IFFALSE( setlocale(LC_ALL, loc.utf8().c_str()), _BS(L"invalid locale : ") << loc << _BS::wget );
|
||||
}
|
||||
|
||||
iResolution = (int)oProps.getIntProperty(L"Ja2 Settings", L"SCREEN_RESOLUTION", -1);
|
||||
|
||||
vfs::Settings::setUseUnicode( !oProps.getBoolProperty(L"Ja2 Settings", L"VFS_NO_UNICODE", false) );
|
||||
|
||||
std::list<utf8string> ini_list;
|
||||
std::list<vfs::String> ini_list;
|
||||
|
||||
utf8string vfs_config_file;
|
||||
vfs::String vfs_config_file;
|
||||
if(oProps.getStringProperty(L"Ja2 Settings", L"VFS_CONFIG", vfs_config_file))
|
||||
{
|
||||
CPropertyContainer temp_cont;
|
||||
vfs::PropertyContainer temp_cont;
|
||||
temp_cont.initFromIniFile(vfs_config_file);
|
||||
utf8string temp_str;
|
||||
vfs::String temp_str;
|
||||
if(temp_cont.getStringProperty(L"vfs_config", L"VFS_CONFIG_INI", temp_str))
|
||||
{
|
||||
oProps.setStringProperty(L"Ja2 Settings", L"VFS_CONFIG_INI", temp_str);
|
||||
@@ -1298,7 +1367,7 @@ void GetRuntimeSettings( )
|
||||
if(oProps.getStringListProperty(L"Ja2 Settings", L"VFS_CONFIG_INI", ini_list, L""))
|
||||
{
|
||||
vfs_config_ini.clear();
|
||||
for(std::list<utf8string>::iterator it = ini_list.begin(); it != ini_list.end(); ++it)
|
||||
for(std::list<vfs::String>::iterator it = ini_list.begin(); it != ini_list.end(); ++it)
|
||||
{
|
||||
vfs_config_ini.push_back(*it);
|
||||
}
|
||||
@@ -1307,6 +1376,25 @@ void GetRuntimeSettings( )
|
||||
{
|
||||
vfs_config_ini.push_back(L"vfs_config.ini");
|
||||
}
|
||||
std::list<vfs::String> merge_list;
|
||||
if(oProps.getStringListProperty(L"Ja2 Settings", L"MERGE_INI_FILES", merge_list, L""))
|
||||
{
|
||||
for(std::list<vfs::String>::iterator it = merge_list.begin(); it != merge_list.end(); ++it)
|
||||
{
|
||||
CIniReader::RegisterFileForMerging(*it);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_VFS
|
||||
extern bool g_bUsePngItemImages;
|
||||
g_bUsePngItemImages = oProps.getBoolProperty(L"Ja2 Settings", L"USE_PNG_ITEM_IMAGES", false);
|
||||
g_bUseXML_Structures = oProps.getBoolProperty(L"Ja2 Settings", L"USE_XML_STRUCTURES", false);
|
||||
g_bUseXML_Tilesets = oProps.getBoolProperty(L"Ja2 Settings", L"USE_XML_TILESETS", false);
|
||||
g_bUseXML_Strings = oProps.getBoolProperty(L"Ja2 Settings", L"USE_XML_STRINGS", false);
|
||||
s_bExportStrings = oProps.getBoolProperty(L"Ja2 Settings", L"EXPORT_STRINGS", false);
|
||||
|
||||
sp_force_load_jsd_xml_file = oProps.getStringProperty(L"Ja2 Settings", L"FORCE_LOAD_JSD_XML_FILE", L"");
|
||||
#endif
|
||||
|
||||
#ifdef JA2EDITOR
|
||||
@@ -1320,11 +1408,6 @@ void GetRuntimeSettings( )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_VFS
|
||||
extern bool g_bUsePngItemImages;
|
||||
g_bUsePngItemImages = oProps.getBoolProperty(L"Ja2 Settings", "USE_PNG_ITEM_IMAGES", false);
|
||||
#endif
|
||||
|
||||
int iResX;
|
||||
int iResY;
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
#ifndef _SGP_AUTO_MEMORY_H_
|
||||
#define _SGP_AUTO_MEMORY_H_
|
||||
|
||||
namespace sgp
|
||||
{
|
||||
/************************************************************/
|
||||
|
||||
template<typename T>
|
||||
class TAutoArray
|
||||
{
|
||||
public:
|
||||
T& operator[](size_t index)
|
||||
{
|
||||
return _array[index];
|
||||
}
|
||||
|
||||
T* operator()()
|
||||
{
|
||||
return _array;
|
||||
}
|
||||
T* operator->()
|
||||
{
|
||||
return _array;
|
||||
}
|
||||
T& operator*()
|
||||
{
|
||||
return *_array;
|
||||
}
|
||||
bool operator!()
|
||||
{
|
||||
// NULL == _array
|
||||
return !_array;
|
||||
}
|
||||
|
||||
T* release()
|
||||
{
|
||||
T* tmp = _array;
|
||||
_array = NULL;
|
||||
return tmp;
|
||||
}
|
||||
protected:
|
||||
T* _array;
|
||||
};
|
||||
|
||||
/************************************************************/
|
||||
|
||||
template<typename T>
|
||||
class AutoArray : public TAutoArray<T>
|
||||
{
|
||||
public:
|
||||
AutoArray(size_t size)
|
||||
{
|
||||
_array = new T[size];
|
||||
}
|
||||
~AutoArray()
|
||||
{
|
||||
if(_array)
|
||||
{
|
||||
delete[] _array;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/************************************************************/
|
||||
|
||||
template<typename T, typename void*(*Alloc)(size_t) = malloc, typename void(*Dealloc)(void*) = free>
|
||||
class AutoCArray : public TAutoArray<T>
|
||||
{
|
||||
public:
|
||||
AutoCArray(size_t size = 1, size_t sizeof_elem=1)
|
||||
{
|
||||
_array = (T*)Alloc( size * sizeof_elem );
|
||||
}
|
||||
~AutoCArray()
|
||||
{
|
||||
if(_array)
|
||||
{
|
||||
Dealloc(_array);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/************************************************************/
|
||||
|
||||
} // namespace sgp
|
||||
|
||||
#ifdef JA2
|
||||
|
||||
#include "MemMan.h"
|
||||
|
||||
namespace sgp
|
||||
{
|
||||
template<typename T>
|
||||
class AutoMMArray : public sgp::TAutoArray<T>
|
||||
{
|
||||
public:
|
||||
AutoMMArray(size_t size, size_t sizeof_elem=1)
|
||||
{
|
||||
_array = (T*)MemAlloc( size * sizeof_elem );
|
||||
}
|
||||
~AutoMMArray()
|
||||
{
|
||||
if(_array)
|
||||
{
|
||||
MemFree(_array);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _SGP_AUTO_MEMORY_H_
|
||||
@@ -0,0 +1,270 @@
|
||||
#include "sgp_logger.h"
|
||||
#include "Debug.h"
|
||||
#include "Font Control.h"
|
||||
|
||||
#include "Message.h"
|
||||
#include <iostream>
|
||||
|
||||
static inline void flush_screen(std::wstringstream& stream)
|
||||
{
|
||||
std::wstring str = stream.str();
|
||||
if(!str.empty())
|
||||
{
|
||||
ScreenMsg(MSG_FONT_YELLOW, 255, (STR16)str.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
int sgp::Logger::_next_log_id = -1;
|
||||
|
||||
#if defined(USE_VFS)
|
||||
//std::vector<sgp::Logger::STimeLog> sgp::Logger::_logs;
|
||||
std::vector<sgp::Logger::LogData> sgp::Logger::_logs;
|
||||
#endif
|
||||
|
||||
sgp::Logger::Logger()
|
||||
{
|
||||
#if defined(USE_VFS)
|
||||
connectFile(this->createLogger(), L"game_log.log", false, sgp::Logger::FLUSH_ON_ENDL);
|
||||
#endif
|
||||
}
|
||||
|
||||
sgp::Logger::~Logger()
|
||||
{
|
||||
}
|
||||
|
||||
sgp::Logger& sgp::Logger::instance()
|
||||
{
|
||||
static Logger _logger;
|
||||
return _logger;
|
||||
}
|
||||
|
||||
bool sgp::Logger::init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sgp::Logger::shutdown()
|
||||
{
|
||||
for(::size_t i=0; i < _logs.size(); ++i)
|
||||
{
|
||||
#if defined(USE_VFS)
|
||||
disconnectFile(i);
|
||||
#endif
|
||||
disconnectStream(i);
|
||||
disconnectScreen(i);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
sgp::Logger_ID sgp::Logger::createLogger()
|
||||
{
|
||||
_logs.push_back(sgp::Logger::LogData());
|
||||
Logger_ID id = _logs.size() - 1;
|
||||
_logs[id].timer.startTimer();
|
||||
return id;
|
||||
}
|
||||
|
||||
sgp::Logger::FlushMode sgp::Logger::flushMode(sgp::Logger_ID id)
|
||||
{
|
||||
sgp::Logger::FlushMode fmode = (sgp::Logger::FlushMode)-1;
|
||||
if(id >= 0 && id < _logs.size())
|
||||
{
|
||||
if(_logs[id].file)
|
||||
{
|
||||
vfs::Log::EFlushMode fm = _logs[id].file->flushMode();
|
||||
|
||||
if (fm == vfs::Log::FLUSH_ON_DELETE) fmode = sgp::Logger::FLUSH_ON_DELETE;
|
||||
else if(fm == vfs::Log::FLUSH_IMMEDIATELY) fmode = sgp::Logger::FLUSH_IMMIDIATELY;
|
||||
else if(fm == vfs::Log::FLUSH_BUFFER) fmode = sgp::Logger::FLUSH_FULL_BUFFER;
|
||||
else if(fm == vfs::Log::FLUSH_ON_ENDL) fmode = sgp::Logger::FLUSH_ON_ENDL;
|
||||
}
|
||||
}
|
||||
return fmode;
|
||||
}
|
||||
|
||||
void sgp::Logger::flushMode(sgp::Logger_ID id, sgp::Logger::FlushMode fmode)
|
||||
{
|
||||
if(id >= 0 && id < _logs.size())
|
||||
{
|
||||
vfs::Log::EFlushMode fm;
|
||||
if (fmode == sgp::Logger::FLUSH_ON_DELETE) fm = vfs::Log::FLUSH_ON_DELETE;
|
||||
else if(fmode == sgp::Logger::FLUSH_IMMIDIATELY) fm = vfs::Log::FLUSH_IMMEDIATELY;
|
||||
else if(fmode == sgp::Logger::FLUSH_FULL_BUFFER) fm = vfs::Log::FLUSH_BUFFER;
|
||||
else if(fmode == sgp::Logger::FLUSH_ON_ENDL) fm = vfs::Log::FLUSH_ON_ENDL;
|
||||
else fm = vfs::Log::FLUSH_IMMEDIATELY;
|
||||
|
||||
if(_logs[id].file)
|
||||
{
|
||||
_logs[id].file->releaseFile();
|
||||
_logs[id].file->flushMode(fm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(USE_VFS)
|
||||
void sgp::Logger::connectFile(sgp::Logger_ID id, vfs::Path const& log_file, bool append, FlushMode fmode)
|
||||
{
|
||||
if(id >= 0 && id < _logs.size())
|
||||
{
|
||||
vfs::Log::EFlushMode fm;
|
||||
if (fmode == sgp::Logger::FLUSH_ON_DELETE) fm = vfs::Log::FLUSH_ON_DELETE;
|
||||
else if(fmode == sgp::Logger::FLUSH_IMMIDIATELY) fm = vfs::Log::FLUSH_IMMEDIATELY;
|
||||
else if(fmode == sgp::Logger::FLUSH_FULL_BUFFER) fm = vfs::Log::FLUSH_BUFFER;
|
||||
else if(fmode == sgp::Logger::FLUSH_ON_ENDL) fm = vfs::Log::FLUSH_ON_ENDL;
|
||||
else fm = vfs::Log::FLUSH_IMMEDIATELY;
|
||||
|
||||
_logs[id].file = vfs::Log::create(log_file,append,fm);
|
||||
}
|
||||
}
|
||||
void sgp::Logger::disconnectFile(sgp::Logger_ID id)
|
||||
{
|
||||
if(id >= 0 && id < _logs.size())
|
||||
{
|
||||
if(_logs[id].file)
|
||||
{
|
||||
_logs[id].file->destroy();
|
||||
_logs[id].file = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void sgp::Logger::connectStream(sgp::Logger_ID id, std::ostream& stream)
|
||||
{
|
||||
if(id >= 0 && id < _logs.size())
|
||||
{
|
||||
_logs[id].stream = &std::wcout;
|
||||
}
|
||||
}
|
||||
void sgp::Logger::disconnectStream(sgp::Logger_ID id)
|
||||
{
|
||||
if(id >= 0 && id < _logs.size())
|
||||
{
|
||||
_logs[id].stream = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void sgp::Logger::connectScreen(sgp::Logger_ID id)
|
||||
{
|
||||
if(id >= 0 && id < _logs.size())
|
||||
{
|
||||
if(_logs[id].screen)
|
||||
{
|
||||
disconnectScreen(id);
|
||||
}
|
||||
_logs[id].screen = new std::wstringstream;
|
||||
}
|
||||
}
|
||||
void sgp::Logger::disconnectScreen(sgp::Logger_ID id)
|
||||
{
|
||||
if(id >= 0 && id < _logs.size())
|
||||
{
|
||||
if(_logs[id].screen)
|
||||
{
|
||||
flush_screen(*_logs[id].screen);
|
||||
delete _logs[id].screen;
|
||||
_logs[id].screen = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//#if defined(USE_VFS)
|
||||
//int sgp::Logger::createLogger(vfs::Path const& log_file, bool append, FlushMode fp)
|
||||
//{
|
||||
// vfs::Log::EFlushMode fm;
|
||||
// if(fp == sgp::Logger::FLUSH_ON_DELETE) fm = vfs::Log::FLUSH_ON_DELETE;
|
||||
// else if(fp == sgp::Logger::FLUSH_IMMIDIATELY) fm = vfs::Log::FLUSH_IMMEDIATELY;
|
||||
// else if(fp == sgp::Logger::FLUSH_FULL_BUFFER) fm = vfs::Log::FLUSH_BUFFER;
|
||||
// else if(fp == sgp::Logger::FLUSH_ON_ENDL) fm = vfs::Log::FLUSH_ON_ENDL;
|
||||
// else fm = vfs::Log::FLUSH_IMMEDIATELY;
|
||||
//
|
||||
// _logs.push_back(STimeLog());
|
||||
// _next_log_id++;
|
||||
// _logs[_next_log_id]._log = vfs::Log::create(log_file,append,fm);
|
||||
// _logs[_next_log_id]._timer.startTimer();
|
||||
// return _next_log_id;
|
||||
//}
|
||||
//#endif
|
||||
|
||||
sgp::Logger::LogInstance sgp::Logger::logger(sgp::Logger_ID id)
|
||||
{
|
||||
if(id < _logs.size())
|
||||
{
|
||||
#if defined(USE_VFS)
|
||||
std::wstringstream tmp;
|
||||
tmp << L"[" << _logs[id].timer.running() << L"] : ";
|
||||
std::wstring str(tmp.str());
|
||||
|
||||
LogData& ld = _logs[id];
|
||||
if(ld.file) {
|
||||
(*ld.file).lock();
|
||||
(*ld.file) << str;
|
||||
}
|
||||
if(ld.stream) {
|
||||
(*ld.stream) << str;
|
||||
}
|
||||
if(ld.screen) {
|
||||
(*ld.screen) << str;
|
||||
}
|
||||
#endif
|
||||
return sgp::Logger::LogInstance(&ld);
|
||||
}
|
||||
SGP_THROW(L"Unknown log id");
|
||||
}
|
||||
|
||||
template <>
|
||||
sgp::Logger::LogInstance& sgp::Logger::LogInstance::operator<< <sgp::_flush>(sgp::_flush const& e)
|
||||
{
|
||||
if(_log.file)
|
||||
{
|
||||
#if defined(USE_VFS)
|
||||
(*_log.file).flush();
|
||||
(*_log.file).unlock();
|
||||
#endif
|
||||
}
|
||||
if(_log.stream)
|
||||
{
|
||||
(*_log.stream).flush();
|
||||
}
|
||||
if(_log.screen)
|
||||
{
|
||||
flush_screen(*_log.screen);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <>
|
||||
sgp::Logger::LogInstance& sgp::Logger::LogInstance::operator<< <sgp::_endl>(sgp::_endl const& e)
|
||||
{
|
||||
if(_log.file)
|
||||
{
|
||||
#if defined(USE_VFS)
|
||||
(*_log.file) << vfs::Log::endl;
|
||||
if(_log.file->flushMode() == vfs::Log::FLUSH_ON_ENDL)
|
||||
{
|
||||
(*_log.file).flush();
|
||||
}
|
||||
(*_log.file).unlock();
|
||||
#endif
|
||||
}
|
||||
if(_log.stream)
|
||||
{
|
||||
(*_log.stream) << std::endl;
|
||||
(*_log.stream).flush();
|
||||
}
|
||||
if(_log.screen)
|
||||
{
|
||||
flush_screen(*_log.screen);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
template <>
|
||||
sgp::Logger::LogInstance& sgp::Logger::LogInstance::operator<< <sgp::_lock>(sgp::_lock const& l)
|
||||
{
|
||||
#if defined(USE_VFS)
|
||||
_log.file->lock();
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
#ifndef SGP_LOGGER_H
|
||||
#define SGP_LOGGER_H
|
||||
|
||||
#include <vector>
|
||||
#if defined(USE_VFS)
|
||||
# include <vfs/Core/vfs_string.h>
|
||||
# include <vfs/Tools/vfs_log.h>
|
||||
# include <vfs/Tools/vfs_hp_timer.h>
|
||||
#else
|
||||
# include <iostream>
|
||||
#endif
|
||||
|
||||
namespace sgp
|
||||
{
|
||||
typedef unsigned int Logger_ID;
|
||||
|
||||
enum _endl{endl};
|
||||
enum _lock{lock};
|
||||
enum _flush{flush};
|
||||
|
||||
class Logger
|
||||
{
|
||||
struct LogData
|
||||
{
|
||||
#if defined(USE_VFS)
|
||||
LogData() : file(NULL), stream(NULL), screen(NULL) {};
|
||||
vfs::HPTimer timer;
|
||||
vfs::Log* file;
|
||||
#else
|
||||
LogData() : stream(NULL), screen(NULL) {};
|
||||
#endif
|
||||
std::wostream* stream;
|
||||
std::wstringstream* screen;
|
||||
};
|
||||
public:
|
||||
|
||||
enum FlushMode
|
||||
{
|
||||
FLUSH_ON_DELETE,
|
||||
FLUSH_ON_ENDL,
|
||||
FLUSH_ON_FLUSH,
|
||||
FLUSH_FULL_BUFFER,
|
||||
FLUSH_IMMIDIATELY,
|
||||
};
|
||||
|
||||
// need to lock/unlock on every logging operation, as they can be called from multiple threads
|
||||
class LogInstance
|
||||
{
|
||||
friend class Logger;
|
||||
LogInstance(LogData* ld) : _log(*ld) {};
|
||||
public:
|
||||
template <typename T>
|
||||
LogInstance& operator<<(T const& t){
|
||||
if(_log.stream) (*_log.stream) << t;
|
||||
if(_log.screen) (*_log.screen) << t;
|
||||
#if defined(USE_VFS)
|
||||
if(_log.file ) (*_log.file) << t;
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
private:
|
||||
LogData& _log;
|
||||
};
|
||||
|
||||
|
||||
static Logger& instance();
|
||||
|
||||
bool init();
|
||||
bool shutdown();
|
||||
|
||||
LogInstance logger(Logger_ID id);
|
||||
|
||||
Logger_ID createLogger();
|
||||
|
||||
#if defined(USE_VFS)
|
||||
void connectFile(Logger_ID id, vfs::Path const& log_file, bool append, FlushMode fp);
|
||||
void disconnectFile(Logger_ID id);
|
||||
#endif
|
||||
void connectStream(Logger_ID id, std::ostream& stream);
|
||||
void disconnectStream(Logger_ID id);
|
||||
|
||||
void connectScreen(Logger_ID id);
|
||||
void disconnectScreen(Logger_ID id);
|
||||
|
||||
void flushMode(Logger_ID id, FlushMode fmode);
|
||||
FlushMode flushMode(Logger_ID id);
|
||||
private:
|
||||
Logger();
|
||||
~Logger();
|
||||
|
||||
private:
|
||||
static int _next_log_id;
|
||||
|
||||
static std::vector<LogData> _logs;
|
||||
};
|
||||
|
||||
template <>
|
||||
Logger::LogInstance& Logger::LogInstance::operator<< <_endl>(_endl const& e);
|
||||
template <>
|
||||
Logger::LogInstance& Logger::LogInstance::operator<< <_lock>(_lock const& l);
|
||||
template <>
|
||||
Logger::LogInstance& Logger::LogInstance::operator<< <_flush>(_flush const& f);
|
||||
}
|
||||
|
||||
#if defined(USE_VFS)
|
||||
inline sgp::Logger::LogInstance SGP_LOG(sgp::Logger_ID id, vfs::String const& str){
|
||||
#else
|
||||
inline sgp::Logger::LogInstance SGP_LOG(int id, const char* str){
|
||||
#endif
|
||||
return sgp::Logger::instance().logger(id) << (str) << sgp::endl;
|
||||
}
|
||||
inline sgp::Logger::LogInstance SGP_LOG(sgp::Logger_ID id){
|
||||
return sgp::Logger::instance().logger(id);
|
||||
}
|
||||
|
||||
#if defined(USE_VFS)
|
||||
inline sgp::Logger::LogInstance SGP_INFO(vfs::String const& str){
|
||||
#else
|
||||
inline sgp::Logger::LogInstance SGP_INFO(const char* str){
|
||||
#endif
|
||||
return sgp::Logger::instance().logger(0) << str << sgp::endl;
|
||||
}
|
||||
inline sgp::Logger::LogInstance SGP_INFO(){
|
||||
return sgp::Logger::instance().logger(0);
|
||||
}
|
||||
|
||||
#if defined(USE_VFS)
|
||||
inline sgp::Logger::LogInstance SGP_WARNING(vfs::String const& str){
|
||||
#else
|
||||
inline sgp::Logger::LogInstance SGP_WARNING(const char* str){
|
||||
#endif
|
||||
return sgp::Logger::instance().logger(0) << "WARNING : " << str << sgp::endl;
|
||||
}
|
||||
inline sgp::Logger::LogInstance SGP_WARNING(){
|
||||
return sgp::Logger::instance().logger(0) << "WARNING : ";
|
||||
}
|
||||
|
||||
#if defined(USE_VFS)
|
||||
inline sgp::Logger::LogInstance SGP_ERROR(vfs::String const& str){
|
||||
#else
|
||||
inline sgp::Logger::LogInstance SGP_ERROR(const char* str){
|
||||
#endif
|
||||
return sgp::Logger::instance().logger(0) << "ERROR : " << str << sgp::endl;
|
||||
}
|
||||
inline sgp::Logger::LogInstance SGP_ERROR(){
|
||||
return sgp::Logger::instance().logger(0) << "ERROR : ";
|
||||
}
|
||||
|
||||
#endif // SGP_LOGGER_H
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "random.h"
|
||||
#include "fmod.h"
|
||||
#include "fmod_errors.h"
|
||||
#include "sgp_logger.h"
|
||||
#endif
|
||||
|
||||
// Uncomment this to disable the startup of sound hardware
|
||||
@@ -1801,14 +1802,16 @@ UINT32 uiCount;
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/Tools/Log.h"
|
||||
|
||||
// Lesh modifications
|
||||
// Sound debug
|
||||
#ifdef USE_VFS
|
||||
static CLog& s_SoundLog = *CLog::create(SndDebugFileName,true);
|
||||
#endif
|
||||
static struct SoundLog {
|
||||
sgp::Logger_ID id;
|
||||
SoundLog() {
|
||||
id = sgp::Logger::instance().createLogger();
|
||||
sgp::Logger::instance().connectFile(id, SndDebugFileName, true, sgp::Logger::FLUSH_ON_DELETE);
|
||||
}
|
||||
} s_SoundLog;
|
||||
|
||||
//*****************************************************************************************
|
||||
// SoundLog
|
||||
// Writes string into log file
|
||||
@@ -1826,7 +1829,7 @@ void SoundLog(CHAR8 *strMessage)
|
||||
fclose(SndDebug);
|
||||
}
|
||||
#else
|
||||
s_SoundLog << strMessage << CLog::ENDL;
|
||||
SGP_LOG(s_SoundLog.id, vfs::String::widen(strMessage,strlen(strMessage)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
#include "Fileman.h"
|
||||
#include "Input.h"
|
||||
#include "GameSettings.h"
|
||||
#include "sgp_logger.h"
|
||||
#endif
|
||||
|
||||
#include "resource.h"
|
||||
#include "VFS/vfs.h"
|
||||
#include "VFS/vfs_file_raii.h"
|
||||
#include <vfs/Core/vfs.h>
|
||||
#include <vfs/Core/vfs_file_raii.h>
|
||||
|
||||
#include "Local.h"
|
||||
#include "text.h"
|
||||
@@ -665,15 +666,39 @@ void ShutdownVideoManager(void)
|
||||
// down
|
||||
//
|
||||
|
||||
IDirectDrawSurface2_Release(gpMouseCursorOriginal);
|
||||
IDirectDrawSurface2_Release(gpMouseCursor);
|
||||
IDirectDrawSurface2_Release(gMouseCursorBackground[0].pSurface);
|
||||
IDirectDrawSurface2_Release(gpBackBuffer);
|
||||
IDirectDrawSurface2_Release(gpPrimarySurface);
|
||||
if(gpMouseCursorOriginal)
|
||||
{
|
||||
IDirectDrawSurface2_Release(gpMouseCursorOriginal);
|
||||
gpMouseCursorOriginal = NULL;
|
||||
}
|
||||
if(gpMouseCursor)
|
||||
{
|
||||
IDirectDrawSurface2_Release(gpMouseCursor);
|
||||
gpMouseCursor = NULL;
|
||||
}
|
||||
if(gMouseCursorBackground[0].pSurface)
|
||||
{
|
||||
IDirectDrawSurface2_Release(gMouseCursorBackground[0].pSurface);
|
||||
gMouseCursorBackground[0].pSurface = NULL;
|
||||
}
|
||||
if(gpBackBuffer)
|
||||
{
|
||||
IDirectDrawSurface2_Release(gpBackBuffer);
|
||||
gpBackBuffer = NULL;
|
||||
}
|
||||
if(gpPrimarySurface)
|
||||
{
|
||||
IDirectDrawSurface2_Release(gpPrimarySurface);
|
||||
gpPrimarySurface = NULL;
|
||||
}
|
||||
|
||||
IDirectDraw2_RestoreDisplayMode( gpDirectDrawObject );
|
||||
IDirectDraw2_SetCooperativeLevel(gpDirectDrawObject, ghWindow, DDSCL_NORMAL );
|
||||
IDirectDraw2_Release( gpDirectDrawObject );
|
||||
if(gpDirectDrawObject)
|
||||
{
|
||||
IDirectDraw2_RestoreDisplayMode( gpDirectDrawObject );
|
||||
IDirectDraw2_SetCooperativeLevel(gpDirectDrawObject, ghWindow, DDSCL_NORMAL );
|
||||
IDirectDraw2_Release( gpDirectDrawObject );
|
||||
gpDirectDrawObject = NULL;
|
||||
}
|
||||
|
||||
// destroy the window
|
||||
// DestroyWindow( ghWindow );
|
||||
@@ -1993,7 +2018,7 @@ void RefreshScreen(void *DummyVariable)
|
||||
{
|
||||
vfs::COpenWriteFile wfile(FileName,true,true);
|
||||
char head[] = {0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, LOBYTE(SCREEN_WIDTH), HIBYTE(SCREEN_WIDTH), LOBYTE(SCREEN_HEIGHT), HIBYTE(SCREEN_HEIGHT), 0x10, 0};
|
||||
TRYCATCH_RETHROW(wfile.file().write(head,18), L"");
|
||||
SGP_TRYCATCH_RETHROW(wfile->write(head,18), L"");
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -2034,7 +2059,7 @@ void RefreshScreen(void *DummyVariable)
|
||||
#ifndef USE_VFS
|
||||
fwrite( p16BPPData, SCREEN_WIDTH * 2, 1, OutputFile);
|
||||
#else
|
||||
TRYCATCH_RETHROW(wfile.file().write((vfs::Byte*)p16BPPData, SCREEN_WIDTH * 2), L"");
|
||||
SGP_TRYCATCH_RETHROW(wfile->write((vfs::Byte*)p16BPPData, SCREEN_WIDTH * 2), L"");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -2042,7 +2067,7 @@ void RefreshScreen(void *DummyVariable)
|
||||
#ifndef USE_VFS
|
||||
fwrite((void *)(((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2)), SCREEN_WIDTH * 2, 1, OutputFile);
|
||||
#else
|
||||
TRYCATCH_RETHROW(wfile.file().write((vfs::Byte*)(((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2)), SCREEN_WIDTH * 2), L"");
|
||||
SGP_TRYCATCH_RETHROW(wfile->write((vfs::Byte*)(((UINT8 *)SurfaceDescription.lpSurface) + (iIndex * SCREEN_WIDTH * 2)), SCREEN_WIDTH * 2), L"");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -2069,9 +2094,9 @@ void RefreshScreen(void *DummyVariable)
|
||||
}
|
||||
|
||||
#ifdef USE_VFS
|
||||
catch(CBasicException& ex)
|
||||
catch(std::exception& ex)
|
||||
{
|
||||
RETHROWEXCEPTION(L"",&ex);
|
||||
SGP_RETHROW(L"", ex);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3177,8 +3202,12 @@ void FatalError( const STR8 pError, ...)
|
||||
gfFatalError = TRUE;
|
||||
|
||||
// Release DDraw
|
||||
IDirectDraw2_RestoreDisplayMode( gpDirectDrawObject );
|
||||
IDirectDraw2_Release( gpDirectDrawObject );
|
||||
if(gpDirectDrawObject)
|
||||
{
|
||||
IDirectDraw2_RestoreDisplayMode( gpDirectDrawObject );
|
||||
IDirectDraw2_Release( gpDirectDrawObject );
|
||||
gpDirectDrawObject = NULL;
|
||||
}
|
||||
ShowWindow( ghWindow, SW_HIDE );
|
||||
|
||||
// destroy the window
|
||||
@@ -3186,8 +3215,8 @@ void FatalError( const STR8 pError, ...)
|
||||
|
||||
gfProgramIsRunning = FALSE;
|
||||
|
||||
MessageBox( ghWindow, gFatalErrorString, "JA2 Fatal Error", MB_OK | MB_TASKMODAL );
|
||||
|
||||
//MessageBox( ghWindow, gFatalErrorString, "JA2 Fatal Error", MB_OK | MB_TASKMODAL );
|
||||
MessageBoxW( ghWindow, vfs::String::as_utf16(gFatalErrorString).c_str(), L"JA2 Fatal Error", MB_OK | MB_TASKMODAL );
|
||||
}
|
||||
|
||||
|
||||
@@ -3383,7 +3412,7 @@ void RefreshMovieCache( )
|
||||
#ifndef USE_VFS
|
||||
fwrite(&Header, sizeof(TARGA_HEADER), 1, disk);
|
||||
#else
|
||||
TRYCATCH_RETHROW(wfile.file().write((vfs::Byte*)&Header, sizeof(TARGA_HEADER)), L"");
|
||||
SGP_TRYCATCH_RETHROW(wfile->write((vfs::Byte*)&Header, sizeof(TARGA_HEADER)), L"");
|
||||
#endif
|
||||
pDest = gpFrameData[ cnt ];
|
||||
|
||||
@@ -3394,7 +3423,7 @@ void RefreshMovieCache( )
|
||||
#ifndef USE_VFS
|
||||
fwrite( ( pDest + ( iCountY * SCREEN_WIDTH ) + iCountX ), sizeof(UINT16), 1, disk);
|
||||
#else
|
||||
TRYCATCH_RETHROW(wfile.file().write( (vfs::Byte*)( pDest + ( iCountY * SCREEN_WIDTH ) + iCountX ), sizeof(UINT16)), L"");
|
||||
SGP_TRYCATCH_RETHROW(wfile->write( (vfs::Byte*)( pDest + ( iCountY * SCREEN_WIDTH ) + iCountX ), sizeof(UINT16)), L"");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3414,9 +3443,9 @@ void RefreshMovieCache( )
|
||||
//SetFileManCurrentDirectory( ExecDir );
|
||||
#else
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(std::exception& ex)
|
||||
{
|
||||
logException(ex);
|
||||
SGP_ERROR(ex.what());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ BOOLEAN BltVideoObjectFromIndex(UINT32 uiDestVSurface, UINT32 uiSrcVObject, UINT
|
||||
// Now we have the video object and surface, call the VO blitter function
|
||||
if ( !BltVideoObjectToBuffer( pBuffer, uiPitch, hSrcVObject, usRegionIndex, iDestX, iDestY, fBltFlags, pBltFx ) )
|
||||
{
|
||||
UnLockVideoSurface( uiDestVSurface );
|
||||
UnLockVideoSurface( uiDestVSurface );
|
||||
// VO Blitter will set debug messages for error conditions
|
||||
return FALSE;
|
||||
}
|
||||
@@ -434,8 +434,19 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
|
||||
{
|
||||
if ( VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMFILE )
|
||||
{
|
||||
ImageFileType::TestOrder order = ImageFileType::JPC_FALLBACK;
|
||||
|
||||
if(VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMJPC) {
|
||||
order = ImageFileType::JPC;
|
||||
} else if(VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMJPC_FALLBACK) {
|
||||
order = ImageFileType::JPC_FALLBACK;
|
||||
} else if(VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMPNG) {
|
||||
order = ImageFileType::PNG_FALLBACK;
|
||||
} else if(VObjectDesc->fCreateFlags & VOBJECT_CREATE_FROMPNG_FALLBACK) {
|
||||
order = ImageFileType::PNG_FALLBACK;
|
||||
}
|
||||
// Create himage object from file
|
||||
hImage = CreateImage( VObjectDesc->ImageFile, IMAGE_ALLIMAGEDATA );
|
||||
hImage = CreateImage( VObjectDesc->ImageFile, IMAGE_ALLIMAGEDATA, order );
|
||||
|
||||
if ( hImage == NULL )
|
||||
{
|
||||
@@ -457,17 +468,31 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
|
||||
|
||||
if(hImage->ubBitDepth == 32)
|
||||
{
|
||||
hVObject->p16BPPObject = new SixteenBPPObjectInfo;
|
||||
int SIZE = hImage->usHeight*hImage->usWidth;
|
||||
hVObject->pPixData = new UINT32[SIZE];
|
||||
memcpy(hVObject->pPixData, hImage->p32BPPData, SIZE*sizeof(UINT32));
|
||||
hVObject->p16BPPObject->p16BPPData = NULL;
|
||||
hVObject->p16BPPObject->sOffsetX = 0;
|
||||
hVObject->p16BPPObject->sOffsetY = 0;
|
||||
hVObject->p16BPPObject->ubShadeLevel = 0;
|
||||
hVObject->p16BPPObject->usHeight = hImage->usHeight;
|
||||
hVObject->p16BPPObject->usWidth = hImage->usWidth;
|
||||
hVObject->p16BPPObject->usRegionIndex = 0;
|
||||
SGP_THROW_IFFALSE(hImage->usNumberOfObjects > 0, L"bad himage");
|
||||
|
||||
// create one 16bpp object (that contains 32bpp data)
|
||||
hVObject->p16BPPObject = (SixteenBPPObjectInfo*)MemAlloc(sizeof(SixteenBPPObjectInfo));
|
||||
if(!hVObject->p16BPPObject)
|
||||
{
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memset(hVObject->p16BPPObject, 0, sizeof(SixteenBPPObjectInfo));
|
||||
|
||||
int SIZE = hImage->pETRLEObject[0].usHeight * hImage->pETRLEObject[0].usWidth * sizeof(UINT32);
|
||||
hVObject->p16BPPObject->p16BPPData = (UINT16*)MemAlloc(SIZE); // UINT32*
|
||||
if(!hVObject->p16BPPObject->p16BPPData)
|
||||
{
|
||||
MemFree(hVObject->p16BPPObject);
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memcpy(hVObject->p16BPPObject->p16BPPData, hImage->p32BPPData, SIZE);
|
||||
|
||||
hVObject->p16BPPObject->sOffsetX = hImage->pETRLEObject[0].sOffsetX;
|
||||
hVObject->p16BPPObject->sOffsetY = hImage->pETRLEObject[0].sOffsetY;
|
||||
hVObject->p16BPPObject->ubShadeLevel = 0;
|
||||
hVObject->p16BPPObject->usHeight = hImage->pETRLEObject[0].usHeight;
|
||||
hVObject->p16BPPObject->usWidth = hImage->pETRLEObject[0].usWidth;
|
||||
hVObject->p16BPPObject->usRegionIndex = 0;
|
||||
|
||||
hVObject->usNumberOf16BPPObjects = 1;
|
||||
hVObject->ubBitDepth = hImage->ubBitDepth;
|
||||
@@ -481,16 +506,31 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
|
||||
}
|
||||
else if(hImage->ubBitDepth == 16)
|
||||
{
|
||||
hVObject->p16BPPObject = new SixteenBPPObjectInfo;
|
||||
int SIZE = hImage->usHeight*hImage->usWidth;
|
||||
hVObject->p16BPPObject->p16BPPData = new UINT16[SIZE];
|
||||
memcpy(hVObject->p16BPPObject->p16BPPData, hImage->p16BPPData, SIZE*sizeof(UINT16));
|
||||
hVObject->p16BPPObject->sOffsetX = 0;
|
||||
hVObject->p16BPPObject->sOffsetY = 0;
|
||||
hVObject->p16BPPObject->ubShadeLevel = 0;
|
||||
hVObject->p16BPPObject->usHeight = hImage->usHeight;
|
||||
hVObject->p16BPPObject->usWidth = hImage->usWidth;
|
||||
hVObject->p16BPPObject->usRegionIndex = 0;
|
||||
SGP_THROW_IFFALSE(hImage->usNumberOfObjects > 0, L"bad himage");
|
||||
|
||||
// create one 16bpp object (that contains 32bpp data)
|
||||
hVObject->p16BPPObject = (SixteenBPPObjectInfo*)MemAlloc(sizeof(SixteenBPPObjectInfo));
|
||||
if(!hVObject->p16BPPObject)
|
||||
{
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memset(hVObject->p16BPPObject, 0, sizeof(SixteenBPPObjectInfo));
|
||||
|
||||
int SIZE = hImage->pETRLEObject[0].usHeight * hImage->pETRLEObject[0].usWidth * sizeof(UINT16);
|
||||
hVObject->p16BPPObject->p16BPPData = (UINT16*)MemAlloc(SIZE);
|
||||
if(!hVObject->p16BPPObject->p16BPPData)
|
||||
{
|
||||
MemFree(hVObject->p16BPPObject);
|
||||
SGP_THROW(L"bad alloc");
|
||||
}
|
||||
memcpy(hVObject->p16BPPObject->p16BPPData, hImage->p16BPPData, SIZE);
|
||||
|
||||
hVObject->p16BPPObject->sOffsetX = hImage->pETRLEObject[0].sOffsetX;
|
||||
hVObject->p16BPPObject->sOffsetY = hImage->pETRLEObject[0].sOffsetY;
|
||||
hVObject->p16BPPObject->ubShadeLevel = 0;
|
||||
hVObject->p16BPPObject->usHeight = hImage->pETRLEObject[0].usHeight;
|
||||
hVObject->p16BPPObject->usWidth = hImage->pETRLEObject[0].usWidth;
|
||||
hVObject->p16BPPObject->usRegionIndex = 0;
|
||||
|
||||
hVObject->usNumberOf16BPPObjects = 1;
|
||||
hVObject->ubBitDepth = hImage->ubBitDepth;
|
||||
@@ -520,9 +560,9 @@ HVOBJECT CreateVideoObject( VOBJECT_DESC *VObjectDesc )
|
||||
|
||||
// Set values
|
||||
hVObject->usNumberOfObjects = TempETRLEData.usNumberOfObjects;
|
||||
hVObject->pETRLEObject = TempETRLEData.pETRLEObject;
|
||||
hVObject->pPixData = TempETRLEData.pPixData;
|
||||
hVObject->uiSizePixData = TempETRLEData.uiSizePixData;
|
||||
hVObject->pETRLEObject = TempETRLEData.pETRLEObject;
|
||||
hVObject->pPixData = TempETRLEData.pPixData;
|
||||
hVObject->uiSizePixData = TempETRLEData.uiSizePixData;
|
||||
|
||||
// Set palette from himage
|
||||
if ( hImage->ubBitDepth == 8 )
|
||||
@@ -768,11 +808,11 @@ UINT32 count;
|
||||
BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, UINT16 usIndex, INT32 iDestX, INT32 iDestY, INT32 fBltFlags, blt_fx *pBltFx )
|
||||
{
|
||||
// Sometimes an exception is thrown in that method.
|
||||
__try
|
||||
//BF __try
|
||||
{
|
||||
// Assertions
|
||||
//Assert( pBuffer != NULL );
|
||||
THROWIFFALSE( pBuffer != NULL, L"No Destination Buffer" );
|
||||
SGP_THROW_IFFALSE( pBuffer != NULL, L"No Destination Buffer" );
|
||||
|
||||
if ( hSrcVObject == NULL )
|
||||
{
|
||||
@@ -780,13 +820,14 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
|
||||
}
|
||||
|
||||
//Assert( hSrcVObject != NULL );
|
||||
THROWIFFALSE( hSrcVObject != NULL, L"No Source Object" )
|
||||
SGP_THROW_IFFALSE( hSrcVObject != NULL, L"No Source Object" )
|
||||
|
||||
SixteenBPPObjectInfo *image = NULL;
|
||||
// Check For Flags and bit depths
|
||||
switch( hSrcVObject->ubBitDepth )
|
||||
{
|
||||
case 32:
|
||||
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
|
||||
image = &hSrcVObject->p16BPPObject[usIndex];
|
||||
#if 0
|
||||
Blt16BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES,
|
||||
@@ -796,24 +837,35 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
|
||||
0 );
|
||||
#else
|
||||
Blt32BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES,
|
||||
(UINT32*)hSrcVObject->pPixData, image->usWidth * sizeof(UINT32),
|
||||
(UINT32*)image->p16BPPData, image->usWidth * sizeof(UINT32),
|
||||
iDestX, iDestY,
|
||||
0, 0, image->usWidth, image->usHeight);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 16:
|
||||
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
|
||||
image = &hSrcVObject->p16BPPObject[usIndex];
|
||||
Blt16BPPTo16BPP( pBuffer, uiDestPitchBYTES,
|
||||
image->p16BPPData, image->usWidth * sizeof(UINT16),
|
||||
iDestX, iDestY,
|
||||
0, 0, image->usWidth, image->usHeight );
|
||||
if ( fBltFlags & VO_BLT_SRCTRANSPARENCY )
|
||||
{
|
||||
Blt16BPPTo16BPPTrans( pBuffer, uiDestPitchBYTES,
|
||||
image->p16BPPData, image->usWidth * sizeof(UINT16),
|
||||
iDestX, iDestY,
|
||||
0, 0, image->usWidth, image->usHeight, 0x1F ); // 0x1f = 5 bits of blue
|
||||
}
|
||||
else
|
||||
{
|
||||
Blt16BPPTo16BPP( pBuffer, uiDestPitchBYTES,
|
||||
image->p16BPPData, image->usWidth * sizeof(UINT16),
|
||||
iDestX, iDestY,
|
||||
0, 0, image->usWidth, image->usHeight );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
||||
THROWIFFALSE( hSrcVObject->usNumberOfObjects > usIndex, L"Video object index is larger than the number of subimages");
|
||||
SGP_THROW_IFFALSE( hSrcVObject->usNumberOfObjects > usIndex, L"Video object index is larger than the number of subimages");
|
||||
// Switch based on flags given
|
||||
do
|
||||
{
|
||||
@@ -877,10 +929,11 @@ BOOLEAN BltVideoObjectToBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJE
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
__except(filter(GetExceptionCode(), GetExceptionInformation()))
|
||||
{
|
||||
return ( TRUE );
|
||||
}
|
||||
//BF
|
||||
//__except(filter(GetExceptionCode(), GetExceptionInformation()))
|
||||
//{
|
||||
// return ( TRUE );
|
||||
//}
|
||||
}
|
||||
|
||||
BOOLEAN PixelateVideoObjectRect( UINT32 uiDestVSurface, INT32 X1, INT32 Y1, INT32 X2, INT32 Y2)
|
||||
@@ -1452,13 +1505,30 @@ BOOLEAN BltVideoObjectOutlineShadowFromIndex(UINT32 uiDestVSurface, UINT32 uiSrc
|
||||
#endif
|
||||
CHECKF( GetVideoObject( &hSrcVObject, uiSrcVObject ) );
|
||||
|
||||
if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) )
|
||||
if(hSrcVObject->ubBitDepth == 8)
|
||||
{
|
||||
Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect );
|
||||
if( BltIsClipped( hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect) )
|
||||
{
|
||||
Blt8BPPDataTo16BPPBufferOutlineShadowClip((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex, &ClippingRect );
|
||||
}
|
||||
else
|
||||
{
|
||||
Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex );
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(hSrcVObject->ubBitDepth == 16)
|
||||
{
|
||||
Blt8BPPDataTo16BPPBufferOutlineShadow((UINT16*)pBuffer, uiPitch, hSrcVObject, iDestX, iDestY, usIndex );
|
||||
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
|
||||
SixteenBPPObjectInfo &image = hSrcVObject->p16BPPObject[0];
|
||||
Blt16BPPTo16BPPTransShadow(pBuffer, uiPitch, image.p16BPPData, image.usWidth * sizeof(UINT16),
|
||||
iDestX, iDestY, 0, 0, image.usWidth, image.usHeight, 0x1F);
|
||||
}
|
||||
else if(hSrcVObject->ubBitDepth == 32)
|
||||
{
|
||||
SGP_THROW_IFFALSE(usIndex < hSrcVObject->usNumberOf16BPPObjects, L"index larger that number images");
|
||||
SixteenBPPObjectInfo &image = hSrcVObject->p16BPPObject[0];
|
||||
Blt32BPPTo16BPPTransShadow(pBuffer, uiPitch, (UINT32*)image.p16BPPData, image.usWidth * sizeof(UINT32),
|
||||
iDestX, iDestY, 0, 0, image.usWidth, image.usHeight);
|
||||
}
|
||||
|
||||
// Now we have the video object and surface, call the VO blitter function
|
||||
|
||||
@@ -72,6 +72,10 @@ typedef struct
|
||||
#define VOBJECT_CREATE_DEFAULT 0x00000020 // Creates and empty object of given width, height and BPP
|
||||
#define VOBJECT_CREATE_FROMFILE 0x00000040 // Creates a video object from a file ( using HIMAGE )
|
||||
#define VOBJECT_CREATE_FROMHIMAGE 0x00000080 // Creates a video object from a pre-loaded hImage
|
||||
#define VOBJECT_CREATE_FROMJPC 0x00010000 // replace file extension : sti -> jpc.7z
|
||||
#define VOBJECT_CREATE_FROMPNG 0x00020000 // replace file extension : sti -> png
|
||||
#define VOBJECT_CREATE_FROMJPC_FALLBACK 0x00100000 // replace file extension : sti -> jpc.7z, fall back to sti when it doesn't exist
|
||||
#define VOBJECT_CREATE_FROMPNG_FALLBACK 0x00200000 // replace file extension : sti -> png, fall back to sti when it doesn't exist
|
||||
|
||||
// VOBJECT FLAGS
|
||||
#define VOBJECT_FLAG_SHADETABLE_SHARED 0x00000100
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "vobject.h"
|
||||
#include "vobject_blitters.h"
|
||||
#include "shading.h"
|
||||
#include "sgp_logger.h"
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
@@ -66,29 +67,33 @@ BOOLEAN Blt32BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pSrc, UI
|
||||
UINT32 w = uiWidth;
|
||||
do
|
||||
{
|
||||
//alpha = (UINT8)((0xFF000000 & *pSrcPtr) >> 24);
|
||||
alpha = 255;
|
||||
// r
|
||||
dst_channel = (UINT8)((0x1F & *pDestPtr) << 3);
|
||||
src_channel = (UINT8)((0xFF & *pSrcPtr) );
|
||||
//red = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
red = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
// a
|
||||
alpha = (UINT8)((0xFF000000 & *pSrcPtr) >> 24);
|
||||
//alpha = 255;
|
||||
if(alpha > 0)
|
||||
{
|
||||
// r
|
||||
dst_channel = (UINT8)((0x1F & *pDestPtr) << 3);
|
||||
src_channel = (UINT8)((0xFF & *pSrcPtr) );
|
||||
red = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
//red = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
// g
|
||||
dst_channel = (UINT8)((0x7E0 & *pDestPtr) >> 3);
|
||||
src_channel = (UINT8)((0xFF00 & *pSrcPtr) >> 8);
|
||||
//green = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
green = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
// g
|
||||
dst_channel = (UINT8)((0x7E0 & *pDestPtr) >> 3);
|
||||
src_channel = (UINT8)((0xFF00 & *pSrcPtr) >> 8);
|
||||
green = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
//green = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
// b
|
||||
dst_channel = (UINT8)((0xF800 & *pDestPtr) >> 8);
|
||||
src_channel = (UINT8)((0xFF0000 & *pSrcPtr) >> 16);
|
||||
//blue = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
blue = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
// b
|
||||
dst_channel = (UINT8)((0xF800 & *pDestPtr) >> 8);
|
||||
src_channel = (UINT8)((0xFF0000 & *pSrcPtr) >> 16);
|
||||
blue = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
//blue = (UINT8)( g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
|
||||
UINT32 newcolor = FROMRGB(red,green,blue);
|
||||
*pDestPtr = Get16BPPColor(newcolor);
|
||||
UINT32 newcolor = FROMRGB(red,green,blue);
|
||||
*pDestPtr = Get16BPPColor(newcolor);
|
||||
}
|
||||
pSrcPtr++;
|
||||
pDestPtr++;
|
||||
}
|
||||
@@ -101,6 +106,75 @@ BOOLEAN Blt32BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pSrc, UI
|
||||
return ( TRUE );
|
||||
}
|
||||
|
||||
BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDst, UINT32 uiDstPitch, UINT32 *pSrc, UINT32 uiSrcPitch, INT32 iDstXPos, INT32 iDstYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight)
|
||||
{
|
||||
UINT32 *pSrcPtr;
|
||||
UINT16 *pDstPtr;
|
||||
UINT32 uiLineSkipDst, uiLineSkipSrc;
|
||||
|
||||
Assert(pDst!=NULL);
|
||||
Assert(pSrc!=NULL);
|
||||
|
||||
pSrcPtr = (UINT32*)((UINT8*)pSrc + (iSrcYPos * uiSrcPitch) + (iSrcXPos * 4));
|
||||
uiLineSkipSrc = uiSrcPitch-(uiWidth*4);
|
||||
|
||||
pDstPtr = (UINT16*)((UINT8*)pDst + (iDstYPos * uiDstPitch) + (iDstXPos * 2));
|
||||
uiLineSkipDst = uiDstPitch-(uiWidth*2);
|
||||
|
||||
UINT8 alpha, dst_channel, src_channel;
|
||||
UINT8 red, green, blue;
|
||||
UINT16 tmpVal;
|
||||
UINT32 newcolor;
|
||||
do
|
||||
{
|
||||
UINT32 w = uiWidth;
|
||||
do
|
||||
{
|
||||
// a
|
||||
alpha = (UINT8)((0xFF000000 & *pSrcPtr) >> 24);
|
||||
//alpha = 255;
|
||||
if(alpha > 0)
|
||||
{
|
||||
#if 1
|
||||
// the darker shade
|
||||
tmpVal = ShadeTable[*pDstPtr];
|
||||
|
||||
// r
|
||||
dst_channel = (UINT8)((0x1F & *pDstPtr) << 3);
|
||||
//src_channel = (UINT8)((0xFF & tmpVal) );
|
||||
src_channel = (UINT8)((0x1F & tmpVal) << 3);
|
||||
red = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
// g
|
||||
dst_channel = (UINT8)((0x7E0 & *pDstPtr) >> 3);
|
||||
//src_channel = (UINT8)((0xFF00 & tmpVal) >> 8);
|
||||
src_channel = (UINT8)((0x7E0 & tmpVal) >> 3);
|
||||
green = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
// b
|
||||
dst_channel = (UINT8)((0xF800 & *pDstPtr) >> 8);
|
||||
//src_channel = (UINT8)((0xFF0000 & tmpVal) >> 16);
|
||||
src_channel = (UINT8)((0xF800 & tmpVal) >> 8);
|
||||
blue = (UINT8)( g_AlphaTimesValueCache[255-alpha][dst_channel] + g_AlphaTimesValueCache[alpha][src_channel] );
|
||||
|
||||
|
||||
newcolor = FROMRGB(red,green,blue);
|
||||
*pDstPtr = Get16BPPColor(newcolor);
|
||||
#else
|
||||
*pDstPtr = ShadeTable[*pDstPtr];
|
||||
#endif
|
||||
}
|
||||
pSrcPtr++;
|
||||
pDstPtr++;
|
||||
}
|
||||
while (--w != 0);
|
||||
pSrcPtr = (UINT32*)((UINT8*)pSrcPtr + uiLineSkipSrc);
|
||||
pDstPtr = (UINT16*)((UINT8*)pDstPtr + uiLineSkipDst);
|
||||
}
|
||||
while (--uiHeight != 0);
|
||||
|
||||
return ( TRUE );
|
||||
}
|
||||
|
||||
|
||||
/* Here are bliting functions. If you dont know what kind of functions they are so :
|
||||
@@ -7007,7 +7081,7 @@ UINT32 uiLineSkipDest, uiLineSkipSrc;
|
||||
}
|
||||
}
|
||||
surfID = SurfaceData::GetSurfaceID((BYTE*)pSrc);
|
||||
if( (ct=g_SurfaceRectangle[surfID].Clip(iSrcXPos, iSrcYPos,uiWidth, uiHeight)) != ClipRectangle::NoClip )
|
||||
if( surfID && (ct=g_SurfaceRectangle[surfID].Clip(iSrcXPos, iSrcYPos,uiWidth, uiHeight)) != ClipRectangle::NoClip )
|
||||
{
|
||||
#if _DEBUG
|
||||
WriteMessageToFile(L"Trying to render from outside of surface surface");
|
||||
@@ -7018,9 +7092,9 @@ UINT32 uiLineSkipDest, uiLineSkipSrc;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(CBasicException& ex)
|
||||
catch(std::exception& ex)
|
||||
{
|
||||
logException(ex);
|
||||
SGP_ERROR(ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -7085,16 +7159,16 @@ BlitDone:
|
||||
**********************************************************************************************/
|
||||
BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans)
|
||||
{
|
||||
UINT16 *pSrcPtr, *pDestPtr;
|
||||
UINT32 uiLineSkipDest, uiLineSkipSrc;
|
||||
UINT16 *pSrcPtr, *pDestPtr;
|
||||
UINT32 uiLineSkipDest, uiLineSkipSrc;
|
||||
|
||||
Assert(pDest!=NULL);
|
||||
Assert(pSrc!=NULL);
|
||||
|
||||
pSrcPtr=(UINT16 *)((UINT8 *)pSrc+(iSrcYPos*uiSrcPitch)+(iSrcXPos*2));
|
||||
pDestPtr=(UINT16 *)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2));
|
||||
uiLineSkipDest=uiDestPitch-(uiWidth*2);
|
||||
uiLineSkipSrc=uiSrcPitch-(uiWidth*2);
|
||||
pSrcPtr = (UINT16*)((UINT8 *)pSrc+(iSrcYPos*uiSrcPitch)+(iSrcXPos*2));
|
||||
pDestPtr = (UINT16*)((UINT8 *)pDest+(iDestYPos*uiDestPitch)+(iDestXPos*2));
|
||||
uiLineSkipDest = uiDestPitch - (uiWidth*2);
|
||||
uiLineSkipSrc = uiSrcPitch - (uiWidth*2);
|
||||
#if 1
|
||||
do
|
||||
{
|
||||
@@ -7143,6 +7217,40 @@ Blit3:
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans)
|
||||
{
|
||||
UINT16 *pSrcPtr, *pDestPtr;
|
||||
UINT32 uiLineSkipDest, uiLineSkipSrc;
|
||||
|
||||
Assert(pDest != NULL);
|
||||
Assert(pSrc != NULL);
|
||||
|
||||
pSrcPtr = (UINT16*)((UINT8 *)pSrc + (iSrcYPos * uiSrcPitch) + (iSrcXPos * 2));
|
||||
pDestPtr = (UINT16*)((UINT8 *)pDest + (iDestYPos * uiDestPitch) + (iDestXPos * 2));
|
||||
uiLineSkipDest = uiDestPitch - (uiWidth * 2);
|
||||
uiLineSkipSrc = uiSrcPitch - (uiWidth * 2);
|
||||
#if 1
|
||||
do
|
||||
{
|
||||
UINT32 w = uiWidth;
|
||||
do
|
||||
{
|
||||
if (*pSrcPtr != usTrans)
|
||||
{
|
||||
*pDestPtr = ShadeTable[*pDestPtr];
|
||||
}
|
||||
pSrcPtr++;
|
||||
pDestPtr++;
|
||||
}
|
||||
while (--w != 0);
|
||||
pSrcPtr = (UINT16*)((UINT8*)pSrcPtr + uiLineSkipSrc);
|
||||
pDestPtr = (UINT16*)((UINT8*)pDestPtr + uiLineSkipDest);
|
||||
}
|
||||
while (--uiHeight != 0);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**********************************************************************************************
|
||||
Blt16BPPTo16BPPMirror
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ BOOLEAN DDBlt8BPPDataTo16BPPBufferShadow( HVOBJECT hDestVObject, HVOBJECT hSrcVO
|
||||
BOOLEAN Blt8BPPTo8BPP(UINT8 *pDest, UINT32 uiDestPitch, UINT8 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight);
|
||||
BOOLEAN Blt16BPPTo16BPP(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight);
|
||||
BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans);
|
||||
BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans);
|
||||
BOOLEAN Blt16BPPTo16BPPFog(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT8 *pFog, UINT16 usFogPitch);
|
||||
BOOLEAN Blt16BPPTo16BPPMirror(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight);
|
||||
|
||||
@@ -188,6 +189,7 @@ BOOLEAN BlitZRect(UINT16 *pZBuffer, UINT32 uiPitch, INT16 sLeft, INT16 sTop, INT
|
||||
// New 16/16 blitters
|
||||
|
||||
BOOLEAN Blt32BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight);
|
||||
BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight);
|
||||
|
||||
BOOLEAN Blt16BPPDataTo16BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion);
|
||||
BOOLEAN Blt16BPPDataTo16BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion);
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace SurfaceData
|
||||
SurfaceData::_surfaceOfData[data] = surfaceID;
|
||||
return data;
|
||||
}
|
||||
THROWEXCEPTION(L"Unregistered surface ID");
|
||||
SGP_THROW(L"Unregistered surface ID");
|
||||
}
|
||||
BYTE* SetSurfaceData(HVSURFACE surface, BYTE* data)
|
||||
{
|
||||
@@ -181,7 +181,7 @@ namespace SurfaceData
|
||||
return data;
|
||||
}
|
||||
}
|
||||
THROWEXCEPTION(L"Unregistered surface");
|
||||
SGP_THROW(L"Unregistered surface");
|
||||
}
|
||||
void ReleaseSurfaceData(tID surfaceID)
|
||||
{
|
||||
@@ -246,7 +246,8 @@ namespace SurfaceData
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
THROWEXCEPTION(L"Pointer to surface invalid");
|
||||
//SGP_THROW(L"Pointer to surface invalid");
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1035,9 +1036,20 @@ HVSURFACE CreateVideoSurface( VSURFACE_DESC *VSurfaceDesc )
|
||||
//
|
||||
// Create himage object from file
|
||||
//
|
||||
ImageFileType::TestOrder order = ImageFileType::JPC_FALLBACK;
|
||||
if(VSurfaceDesc->fCreateFlags & VSURFACE_CREATE_FROMJPC) {
|
||||
order = ImageFileType::JPC;
|
||||
} if(VSurfaceDesc->fCreateFlags & VSURFACE_CREATE_FROMJPC_FALLBACK) {
|
||||
order = ImageFileType::JPC_FALLBACK;
|
||||
} if(VSurfaceDesc->fCreateFlags & VSURFACE_CREATE_FROMPNG) {
|
||||
order = ImageFileType::PNG;
|
||||
} if(VSurfaceDesc->fCreateFlags & VSURFACE_CREATE_FROMPNG_FALLBACK) {
|
||||
order = ImageFileType::PNG_FALLBACK;
|
||||
}
|
||||
|
||||
hImage = CreateImage( VSurfaceDesc->ImageFile, IMAGE_ALLIMAGEDATA );
|
||||
|
||||
SGP_THROW_IFFALSE(hImage = CreateImage( VSurfaceDesc->ImageFile, IMAGE_ALLIMAGEDATA, order ),
|
||||
_BS(L"Could not create video surface from file : ") << vfs::String(VSurfaceDesc->ImageFile) << _BS::wget);
|
||||
|
||||
if ( hImage == NULL )
|
||||
{
|
||||
DbgMessage( TOPIC_VIDEOSURFACE, DBG_LEVEL_2, "Invalid Image Filename given" );
|
||||
|
||||
@@ -54,18 +54,23 @@ typedef struct
|
||||
// Used to describe the memory usage of a video Surface
|
||||
//
|
||||
|
||||
#define VSURFACE_DEFAULT_MEM_USAGE 0x00000001 // Default mem usage is same as DD, try video and then try system. Will usually work
|
||||
#define VSURFACE_VIDEO_MEM_USAGE 0x00000002 // Will force surface into video memory and will fail if it can't
|
||||
#define VSURFACE_SYSTEM_MEM_USAGE 0x00000004 // Will force surface into system memory and will fail if it can't
|
||||
#define VSURFACE_RESERVED_SURFACE 0x00000100 // Reserved for special purposes, like a primary surface
|
||||
#define VSURFACE_DEFAULT_MEM_USAGE 0x00000001 // Default mem usage is same as DD, try video and then try system. Will usually work
|
||||
#define VSURFACE_VIDEO_MEM_USAGE 0x00000002 // Will force surface into video memory and will fail if it can't
|
||||
#define VSURFACE_SYSTEM_MEM_USAGE 0x00000004 // Will force surface into system memory and will fail if it can't
|
||||
#define VSURFACE_RESERVED_SURFACE 0x00000100 // Reserved for special purposes, like a primary surface
|
||||
|
||||
//
|
||||
// Video Surface creation flags
|
||||
// Used in the VSurface_DESC structure to describe creation flags
|
||||
//
|
||||
|
||||
#define VSURFACE_CREATE_DEFAULT 0x00000020 // Creates and empty Surface of given width, height and BPP
|
||||
#define VSURFACE_CREATE_FROMFILE 0x00000040 // Creates a video Surface from a file ( using HIMAGE )
|
||||
#define VSURFACE_CREATE_DEFAULT 0x00000020 // Creates and empty Surface of given width, height and BPP
|
||||
#define VSURFACE_CREATE_FROMFILE 0x00000040 // Creates a video Surface from a file ( using HIMAGE )
|
||||
|
||||
#define VSURFACE_CREATE_FROMJPC 0x00010000 // replace file extension : sti -> jpc.7z
|
||||
#define VSURFACE_CREATE_FROMPNG 0x00020000 // replace file extension : sti -> png
|
||||
#define VSURFACE_CREATE_FROMJPC_FALLBACK 0x00100000 // replace file extension : sti -> jpc.7z, fall back to sti when it doesn't exist
|
||||
#define VSURFACE_CREATE_FROMPNG_FALLBACK 0x00200000 // replace file extension : sti -> png, fall back to sti when it doesn't exist
|
||||
|
||||
//
|
||||
// The following structure is used to define a region of the video Surface
|
||||
|
||||
Reference in New Issue
Block a user