mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-25 01:01:49 +01:00
wiiu: some fixes after merge
This commit is contained in:
parent
acdf6a8505
commit
d639369f08
@ -419,14 +419,12 @@ static sf_count_t sndfile_vio_read(void* ptr, sf_count_t count, void* user_data)
|
||||
return fread(ptr, 1, count, (FILE*)user_data);
|
||||
}
|
||||
|
||||
static sf_count_t
|
||||
sndfile_vio_write(const void* ptr, sf_count_t count, void* user_data)
|
||||
static sf_count_t sndfile_vio_write(const void* ptr, sf_count_t count, void* user_data)
|
||||
{
|
||||
return fwrite(ptr, 1, count, (FILE*)user_data);
|
||||
}
|
||||
|
||||
static sf_count_t
|
||||
sndfile_vio_tell(void* user_data)
|
||||
static sf_count_t sndfile_vio_tell(void* user_data)
|
||||
{
|
||||
return ftell((FILE*)user_data);
|
||||
}
|
||||
@ -653,7 +651,8 @@ static ssize_t mpg123_read_replacement(void* handle, void* data, size_t size)
|
||||
|
||||
static off_t mpg123_seek_replacement(void* handle, off_t offset, int whence)
|
||||
{
|
||||
return fseek((FILE*)handle, offset, whence);
|
||||
fseek((FILE*)handle, (uint32) offset, whence);
|
||||
return ftell((FILE*)handle);
|
||||
}
|
||||
|
||||
class CMP3File : public IDecoder
|
||||
@ -670,7 +669,9 @@ protected:
|
||||
m_pMH(nil),
|
||||
m_bOpened(false),
|
||||
m_nRate(0),
|
||||
m_nChannels(0) {}
|
||||
m_nChannels(0),
|
||||
m_fileHandle(NULL),
|
||||
m_buffer(NULL) {}
|
||||
public:
|
||||
CMP3File(const char *path) :
|
||||
m_pMH(nil),
|
||||
@ -726,6 +727,8 @@ public:
|
||||
}
|
||||
free(m_buffer);
|
||||
|
||||
m_fileHandle = nil;
|
||||
m_buffer = nil;
|
||||
m_pMH = nil;
|
||||
}
|
||||
}
|
||||
@ -799,10 +802,6 @@ class CADFFile : public CMP3File
|
||||
fseek((FILE*)fh, pos, seekType);
|
||||
return ftell((FILE*)fh);
|
||||
}
|
||||
static void r_close(void* fh)
|
||||
{
|
||||
fclose((FILE*)fh);
|
||||
}
|
||||
public:
|
||||
CADFFile(const char* path)
|
||||
{
|
||||
@ -816,10 +815,18 @@ public:
|
||||
int channels = 0;
|
||||
int encoding = 0;
|
||||
|
||||
FILE* f = fopen(path, "rb");
|
||||
m_buffer = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
||||
|
||||
m_bOpened = mpg123_replace_reader_handle(m_pMH, r_read, r_seek, r_close) == MPG123_OK
|
||||
&& mpg123_open_handle(m_pMH, f) == MPG123_OK && mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK;
|
||||
FILE* m_fileHandle = fopen(path, "rb");
|
||||
if (!m_fileHandle) {
|
||||
m_bOpened = false;
|
||||
return;
|
||||
}
|
||||
|
||||
setvbuf(m_fileHandle, m_buffer, _IOFBF, IO_BUFFER_SIZE);
|
||||
|
||||
m_bOpened = mpg123_replace_reader_handle(m_pMH, r_read, r_seek, NULL) == MPG123_OK
|
||||
&& mpg123_open_handle(m_pMH, m_fileHandle) == MPG123_OK && mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK;
|
||||
m_nRate = rate;
|
||||
m_nChannels = channels;
|
||||
|
||||
@ -905,6 +912,7 @@ public:
|
||||
class CVbFile : public IDecoder
|
||||
{
|
||||
FILE *m_pFile;
|
||||
char *m_buffer;
|
||||
CVagDecoder *m_pVagDecoders;
|
||||
|
||||
size_t m_FileSize;
|
||||
@ -934,9 +942,13 @@ public:
|
||||
CVbFile(const char* path, uint32 nSampleRate = 32000, uint8 nChannels = 2) : m_nSampleRate(nSampleRate), m_nChannels(nChannels), m_pVagDecoders(nil), m_ppVagBuffers(nil), m_ppPcmBuffers(nil),
|
||||
m_FileSize(0), m_nNumberOfBlocks(0), m_bBlockRead(false), m_LineInBlock(0), m_CurrentBlock(0)
|
||||
{
|
||||
m_buffer = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
||||
|
||||
m_pFile = fopen(path, "rb");
|
||||
if (!m_pFile) return;
|
||||
|
||||
setvbuf(m_pFile, m_buffer, _IOFBF, IO_BUFFER_SIZE);
|
||||
|
||||
fseek(m_pFile, 0, SEEK_END);
|
||||
m_FileSize = ftell(m_pFile);
|
||||
fseek(m_pFile, 0, SEEK_SET);
|
||||
@ -954,6 +966,7 @@ public:
|
||||
if (m_pFile)
|
||||
{
|
||||
fclose(m_pFile);
|
||||
free(m_buffer);
|
||||
|
||||
delete[] m_pVagDecoders;
|
||||
for (int i = 0; i < m_nChannels; i++)
|
||||
|
@ -1696,7 +1696,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
CollectParameters(&m_nIp, 1);
|
||||
UpdateCompareFlag(*ptr == ScriptParams[0]);
|
||||
UpdateCompareFlag(BSWAP32(*ptr) == ScriptParams[0]);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_INT_LVAR_EQUAL_TO_CONSTANT:
|
||||
@ -1786,7 +1786,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
CollectParameters(&m_nIp, 1);
|
||||
*ptr = ScriptParams[0];
|
||||
*ptr = BSWAP32(ScriptParams[0]);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_LVAR_INT_TO_CONSTANT:
|
||||
|
@ -38,7 +38,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
CollectParameters(&m_nIp, 1);
|
||||
UpdateCompareFlag(*ptr > ScriptParams[0]);
|
||||
UpdateCompareFlag(BSWAP32(*ptr) > ScriptParams[0]);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_INT_LVAR_GREATER_THAN_CONSTANT:
|
||||
@ -52,7 +52,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
UpdateCompareFlag(ScriptParams[0] > *ptr);
|
||||
UpdateCompareFlag(ScriptParams[0] > BSWAP32(*ptr));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CONSTANT_GREATER_THAN_INT_LVAR:
|
||||
@ -66,7 +66,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
||||
{
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
CollectParameters(&m_nIp, 1);
|
||||
UpdateCompareFlag(*ptr >= ScriptParams[0]);
|
||||
UpdateCompareFlag(BSWAP32(*ptr) >= ScriptParams[0]);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_CONSTANT:
|
||||
@ -80,7 +80,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
|
||||
{
|
||||
CollectParameters(&m_nIp, 1);
|
||||
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
||||
UpdateCompareFlag(ScriptParams[0] >= *ptr);
|
||||
UpdateCompareFlag(ScriptParams[0] >= BSWAP32(*ptr));
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_CONSTANT_GREATER_OR_EQUAL_TO_INT_LVAR:
|
||||
|
@ -230,8 +230,12 @@ CFileLoader::LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlo
|
||||
|
||||
while(size > 8){
|
||||
header = (ColHeader*)buffer;
|
||||
modelsize = header->size;
|
||||
modelsize = BSWAP32(header->size);
|
||||
#ifdef BIGENDIAN
|
||||
if(header->ident != 'COLL')
|
||||
#else
|
||||
if(header->ident != 'LLOC')
|
||||
#endif
|
||||
return size-8 < CDSTREAM_SECTOR_SIZE;
|
||||
memcpy(modelname, buffer+8, 24);
|
||||
memcpy(work_buff, buffer+32, modelsize-24);
|
||||
@ -264,8 +268,12 @@ CFileLoader::LoadCollisionFile(uint8 *buffer, uint32 size, uint8 colSlot)
|
||||
|
||||
while(size > 8){
|
||||
header = (ColHeader*)buffer;
|
||||
modelsize = header->size;
|
||||
modelsize = BSWAP32(header->size);
|
||||
#ifdef BIGENDIAN
|
||||
if(header->ident != 'COLL')
|
||||
#else
|
||||
if(header->ident != 'LLOC')
|
||||
#endif
|
||||
return size-8 < CDSTREAM_SECTOR_SIZE;
|
||||
memcpy(modelname, buffer+8, 24);
|
||||
memcpy(work_buff, buffer+32, modelsize-24);
|
||||
|
@ -305,7 +305,7 @@ CanVideoCardDoDXT(void)
|
||||
{
|
||||
#ifdef LIBRW
|
||||
// TODO
|
||||
#ifdef RW_OPENGL
|
||||
#if defined(RW_OPENGL) || defined(__WIIU__)
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
|
@ -214,6 +214,7 @@ CText::ReadChunkHeader(ChunkHeader *buf, int32 file, size_t *offset)
|
||||
CFileMgr::Read(file, (char*)buf, sizeof(ChunkHeader));
|
||||
*offset += sizeof(ChunkHeader);
|
||||
#endif
|
||||
memLittle32(&buf->size);
|
||||
}
|
||||
|
||||
void
|
||||
@ -464,6 +465,11 @@ CMissionTextOffsets::Load(size_t table_size, int file, size_t *offset, int)
|
||||
CFileMgr::Read(file, (char*)data, sizeof(CMissionTextOffsets::Entry) * size);
|
||||
*offset += sizeof(CMissionTextOffsets::Entry) * size;
|
||||
#endif
|
||||
#ifdef BIGENDIAN
|
||||
for (uint16 i = 0; i < size; i++) {
|
||||
memLittle32(&data[i].offset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
char*
|
||||
|
Loading…
Reference in New Issue
Block a user