Commit 8609c764 authored by Gerhard Stein's avatar Gerhard Stein

Pointer alignments

parent 56dc146a
......@@ -146,7 +146,7 @@ void CVideoSettings::release()
std::string scalerStr = mpScalerSelection->getSelection();
const std::string res = mpResolutionSelection->getSelection();
sscanf( res.c_str(), "%hux%hux", &mUserVidConf.m_DisplayRect.w, &mUserVidConf.m_DisplayRect.h )
sscanf( res.c_str(), "%hux%hux", &mUserVidConf.m_DisplayRect.w, &mUserVidConf.m_DisplayRect.h );
if( scalerStr != "none" )
mUserVidConf.m_ScaleXFilter = scalerStr.at(0)-'0';
......
......@@ -96,18 +96,16 @@ bool CGameLauncherMenu::loadResources( const std::string& DataDirectory, const i
{
int version;
unsigned char *p_exedata;
unsigned char *p_exeheader;
CExeFile &ExeFile = g_pBehaviorEngine->m_ExeFile;
version = ExeFile.getEXEVersion();
p_exedata = ExeFile.getRawData();
p_exeheader = ExeFile.getHeaderData();
g_pLogFile->ftextOut("Commander Keen Episode %d (Version %d.%d) was detected.<br>", Episode, version/100, version%100);
if( Episode == 1 && version == 134) g_pLogFile->ftextOut("This version of the game is not supported!<br>");
if(p_exeheader == NULL)
if( ExeFile.getHeaderData() == NULL)
{
g_pLogFile->textOut(RED, "CGameControl::loadResources: Could not load data from the EXE File<br>");
return false;
......
......@@ -99,11 +99,7 @@ bool CAudioGalaxy::LoadFromAudioCK(const CExeFile& ExeFile)
// Open the AUDIOHED so we know where to decompress
uint32_t number_of_audiorecs = 0;
// That size must appear as integer in the ExeFile. Look for it!
/*#if defined(ANDROID)
assert( reinterpret_cast<size_t>(ExeFile.getHeaderData()) % 4 == 0 ); // Make sure the pointer is aligned, or we'll get segfault on Android
#endif*/
//uint32_t *audiohedptr = reinterpret_cast(uint32_t*) (void*) ExeFile.getHeaderData();
uint32_t *audiohedptr = reinterpret_cast<uint32_t*>(ExeFile.getHeaderData());
bool found = false;
for( const uint32_t *endptr = (uint32_t*) (void*) ExeFile.getHeaderData() + ExeFile.getExeDataSize()/sizeof(uint32_t);
......@@ -168,7 +164,9 @@ bool CAudioGalaxy::LoadFromAudioCK(const CExeFile& ExeFile)
const uint32_t audio_comp_data_start = audio_start+sizeof(uint32_t);
//const uint32_t *AudioCompFileData32 = (uint32_t*) (void*) (AudioCompFileData + audio_start);
const uint32_t *AudioCompFileData32 = reinterpret_cast<uint32_t*>(AudioCompFileData + audio_start);
const uint32_t *AudioCompFileData32 = reinterpret_cast<uint32_t*>(
reinterpret_cast<void*>(AudioCompFileData + audio_start));
outsize = *AudioCompFileData32;
byte imfdata[outsize];
......
......@@ -373,7 +373,7 @@ bool CEGAGraphicsGalaxy::begin()
assert(m_episode >= 4);
int ep = m_episode - 4; // index for EpisodeInfo; 0 - keen4, 1 - keen5, etc
unsigned char *p_data = m_Exefile.getHeaderData();
byte *p_data = reinterpret_cast<byte*>(m_Exefile.getHeaderData());
//if(m_episode == 7) exeheaderlen = HEADERLEN_KDREAMS;
if(!m_Exefile.readExeImageSize( p_data, &exeimglen, &exeheaderlen))
......
......@@ -346,7 +346,7 @@ bool CExeFile::readExeImageSize(unsigned char *p_data_start, unsigned long *imgl
byte* CExeFile::getRawData() const
{ return m_rawdata; }
byte* CExeFile::getHeaderData() const
void* CExeFile::getHeaderData() const
{ return m_headerdata; }
byte* CExeFile::getDSegPtr() const
......
......@@ -42,7 +42,7 @@ public:
bool readExeImageSize(unsigned char *p_data_start, unsigned long *imglen, unsigned long *headerlen) const;
byte* getRawData() const;
byte* getHeaderData() const;
void* getHeaderData() const;
byte* getDSegPtr() const;
~CExeFile();
......@@ -72,7 +72,7 @@ private:
int m_episode;
unsigned int m_crc;
byte *m_data;
byte *m_headerdata;
void *m_headerdata;
byte *m_rawdata;
byte *m_data_segment;
std::string m_datadirectory;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment